Search Results for 'code'
-
AuthorSearch Results
-
April 16, 2015 at 10:26 pm #161183
In reply to: How to add create new topic button and….
sina_mech
ParticipantThank you for your reply. The code you just suggested, shows the form in new page. Still users have to choose the parent forum, in which they would like to publish their topic. I was wondering if there is a way that like other forums, user can create the topic IN THE CURRENT FORUM by pishing the NEW TOPIC button at the corresponding forum (without any need to choose the destination forum in the form).
April 16, 2015 at 10:19 pm #161181In reply to: How to add create new topic button and….
Robkk
Moderatoryou can do new page.
just create a new page in wordpress called new-topic or something.
put the shortcode
[bbp-topic-form]in it.then change my function to this instead.
function rk_new_topic_button() { echo '<a href="/new-topic/" class="bbp-new-topic-button button btn input[type="button"]" >New Topic</a>'; } add_action('bbp_template_before_topics_loop','rk_new_topic_button');April 16, 2015 at 10:04 pm #161180Robkk
Moderatoryou could also edit loop-single-reply.php in your child theme and just replace
<a href="<?php bbp_reply_url(); ?>" class="bbp-reply-permalink">#<?php bbp_reply_id(); ?></a>with
<a href="<?php bbp_reply_url(); ?>" class="bbp-reply-permalink">#<?php bbp_reply_position(); ?></a>that should work the same way.
April 16, 2015 at 1:10 pm #161168Robby McCullough
ParticipantHi all!
I am having the same issue. I tried using the code snippets provided by xenous (thanks for those), but they didn’t work 🙁
jturet, if you could explain anything you tried to resolve this issue, we’d really appreciate it. We’re a bit stumped and SMTP/Mail server issues are beyond any of our expertise here. Thanks!
April 16, 2015 at 11:38 am #161163In reply to: limited capabilities for roles in a specific forum
redwolf83
ParticipantOk, Thanks Robin, I’ve solved the matter.
at the beginning of form-topic.php I’ve added this code
<?php $forumid = bbp_get_forum_id(); if ($forumid == YourForumID(in numbers without quote.) ) { $displayed_user = bbp_get_user_id( 0, false, true ); $role = bbp_get_user_role($displayed_user); if ( $role == "bbp_participant" ) { echo '<div class="bbp-template-notice">This forum is marked as closed to new topics from participant, however your can reply to existing topics</div>'; return; } } ?>Thanks for your help, 🙂 ::cheers::
Have a Nice day!April 16, 2015 at 11:12 am #161162wenlujon
Participantok, i got it (loop-replies.php):
<?php $count=1; while ( bbp_replies() ) : bbp_the_reply(); ?> <?php $post_id = get_the_ID(); //save the new count update_post_meta($post_id, 'bbp_seq_test', $count) ; ?> <?php bbp_get_template_part( 'loop', 'single-reply' ); $count = $count + 1 ; ?> <?php endwhile; ?>and define a function show_seq()
$post_id = get_the_ID(); $count = get_post_meta( $post_id, 'bbp_seq_test', true ); echo $count;and then in loop-single-reply.php
` <a href=”<?php bbp_reply_url(); ?>” class=”bbp-reply-permalink”>#<?php show_seq(); ?></a>
`and it works!
please take a look!
http://bbs.circday.com/forums/topic/%E6%B5%8B%E8%AF%95%E6%B0%B4%E5%8D%B0
April 16, 2015 at 10:35 am #161159wenlujon
Participantlooks like loop-single-reply.php is a single reply entry, which file invokes it (in a loop way),
if i can find the caller, maybe I can set the meta data in the caller every time it loops:$index=1 while (replies) set meta data (topic_id) to $index load loop-single-reply.php get meta data (topic_id) in loop-single-reply.php $index++April 16, 2015 at 8:03 am #161157In reply to: Redirect from page to profile url (menu link)
project_subdomain
Participantthanks robkk!
now the profile link is in the main and also in my sidebar menu.
unfortunately i’d need to have it in the sidebar menu only. also i’d need a link to the single profile pages as I’d like to replace the default display of options below the avatar which I’d remove then.which amendments of that code would do that?
April 16, 2015 at 7:41 am #161154In reply to: limited capabilities for roles in a specific forum
Robin W
Moderatoryes you would just put that code in form-topic.php
wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpresswhere %your-theme-name% is the name of your theme
find
wp-content/plugins/bbpress/templates/default/bbpress/form-topic.phpMake a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/form-topic.phpbbPress will now use this template instead of the original
you can then look at how the form does this, and put the appropriate lines in.
April 16, 2015 at 7:36 am #161153Robin W
Moderatorwith code anything is possible !
wp-content/plugins/bbpress/templates/default/bbpress/loop-single-reply.php
line 27
April 16, 2015 at 3:36 am #161145In reply to: Add Custom User Roles
Robin W
Moderatoryou can have multiple roles with the same capabilities, so the original code should be fine.
So I would check
1. that the moderator role which you have renamed Councilman works
2. that if you set up a test user and give them Artisan, that that works (ie is it only her)April 16, 2015 at 12:31 am #161141In reply to: My forums List messed up
Robkk
ModeratorbbPress thinks your forums are a blog post hence the “filed under” .
you need to create a bbpress.php in your child theme from a copy of page.php and remove any unwanted code you do not need for your bbPress forums.
April 15, 2015 at 11:32 pm #161137In reply to: Redirect from page to profile url (menu link)
Robkk
Moderatoryou can do something like this to a link to your profile in the menu
add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' ); function my_nav_menu_profile_link($menu) { if (!is_user_logged_in()) return $menu; else $current_user = wp_get_current_user(); $user=$current_user->user_login ; $profilelink = '<li><a href="/forums/users/' . $user . '/">Your Profile</a></li>'; $menu = $menu . $profilelink; return $menu; }April 15, 2015 at 10:26 pm #161130Robkk
Moderatorif you are really using bbpress v1 then it wouldnt work.
i think that shortcode is only for the newer bbpress v2 wordpress plugin
April 15, 2015 at 9:30 pm #161125In reply to: Simplify Options theme trouble
Robkk
Moderatorwell its tough on my side too since you have a paid theme (the free version doesnt have the show excerpt option) , so i cant just tell you step by step because i have to look at the code of your current theme.
you can create me an admin account ( i need to go to the backend and see your theme files in the wordpress theme editor ) , then send me the login details through my email so i can get this done for you.
April 15, 2015 at 4:16 pm #161121In reply to: Add Custom User Roles
Alice Kaye
ParticipantOkay, so kind of resurrecting my old thread here, but with good reason, because something has gone wrong with the code. Today, I promoted someone (the first person to be promoted to this rank) Artisan, which I’ve hand coded into my functions.php file.
The code:
/* bbPress Custom Roles */ function add_custom_role( $bbp_roles ) { $bbp_roles['bbp_craftsman'] = array( 'name' => 'Craftsman', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); $bbp_roles['bbp_journeyman'] = array( 'name' => 'Journeyman', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); $bbp_roles['bbp_adept'] = array( 'name' => 'Adept', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); $bbp_roles['bbp_artisan'] = array( 'name' => 'Artisan', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as moderator ); $moderator = bbp_get_moderator_role() ; $bbp_roles[$moderator] = array( 'name' => 'Councilman', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as moderator ); $keymaster = bbp_get_keymaster_role() ; $bbp_roles[$keymaster] = array( 'name' => 'Advisor', 'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) // the same capabilities as keymaster ); $apprentice = bbp_get_participant_role() ; $bbp_roles[$apprentice] = array( 'name' => 'Apprentice', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); return $bbp_roles; } add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 ); /* bbPress Custom Roles */As you can see, the way I’ve written it, I had Artisan and Councilman both as moderator roles. This is really how I need it set up.
Currently I’ve adjusted Artisan to:
$bbp_roles['bbp_artisan'] = array( 'name' => 'Artisan', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants );Because for whatever reason, when set to moderator, she could not see our forums at all.
Is there a way to have two moderator ranks, or can there only be one? If so, where have I gone wrong with this? I’m quite confused over it now.
Thanks in advance, you guys have been so helpful through all of my learning. 🙂
April 15, 2015 at 3:13 pm #161120In reply to: Redirect from page to profile url (menu link)
project_subdomain
Participantjust noticed the unlogical doubled url in the code above, but my other tries like for example
$id = bb_get_user_id(); $user = bb_get_username(); $nicename = bb_get_user_nicename('$id','$user'); header('Location: http://domain.com/forums/users/'.$nicename);also should have a mistake.
April 15, 2015 at 2:55 pm #161119Topic: Redirect from page to profile url (menu link)
in forum Troubleshootingproject_subdomain
Participant[WP 4.1.1
bbp 2.5.6]For creating a navigation menu I need to redirect pages to the bbpress profile url as well as to their default options urls. These are domain.com/forums/users/HERE-COMES-THE-USERNAME for showing profile and domain.com/forums/users/HERE-COMES-THE-USERNAME/HERE-COMES-SELECTED-OPTION for selected options.
I tried several ways with code like this on the page’s template file for the redirection to the profile but nothing worked yet.
<?php /* Template Name: show user profile */ $name= bbp_user_profile_url(bbp_get_current_user_id() ); header('Location: http://domain.com/forums/users/'.$name); exit(); ?>Thanks for helping!
April 15, 2015 at 11:52 am #161111In reply to: Simplify Options theme trouble
Dmclean
ParticipantI’m uncomfortable changing the theme code with the explanations on the link that was given. Can you be more specific as to what I need to do? Thanks!
April 15, 2015 at 10:20 am #161107In reply to: Newbie help – profiles and layout through themes
Robin W
Moderator1.
The following if added to your functions file will add fields, you can alter the coding as needed//add code for adding first and last name to registration //1. Add a new form element... add_action('register_form','myplugin_register_form'); function myplugin_register_form (){ $first_name = ( isset( $_POST['first_name'] ) ) ? $_POST['first_name']: ''; $last_name = ( isset( $_POST['last_name'] ) ) ? $_POST['last_name']: ''; ?> <p> <label for="first_name"><?php _e('First Name as people call you eg Dave','mydomain') ?><br /> <input type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr(stripslashes($first_name)); ?>" size="25" /></label> </p> <p> <label for="last_name"><?php _e('Last Name','mydomain') ?><br /> <input type="text" name="last_name" id="last_name" class="input" value="<?php echo esc_attr(stripslashes($last_name)); ?>" size="25" /></label> </p> <?php } //2. Add validation. In this case, we make sure first_name is required. add_filter('registration_errors', 'myplugin_registration_errors', 10, 3); function myplugin_registration_errors ($errors, $sanitized_user_login, $user_email) { if ( empty( $_POST['first_name'] ) ) $errors->add( 'first_name_error', __('<strong>ERROR</strong>: You must include a first name.','mydomain') ); if ( empty( $_POST['last_name'] ) ) $errors->add( 'last_name_error', __('<strong>ERROR</strong>: You must include a last name.','mydomain') ); return $errors; } //3. Finally, save our extra registration user meta. add_action('user_register', 'myplugin_user_register'); function myplugin_user_register ($user_id) { if ( isset( $_POST['first_name'] ) ) update_user_meta($user_id, 'first_name', $_POST['first_name']); if ( isset( $_POST['last_name'] ) ) update_user_meta($user_id, 'last_name', $_POST['last_name']); }Plenty of captcha plugins – just google ‘wordpress plugin captcha’
If you’d like to specify your req’s further, I’ll try to help.
2. no need to change theme, just add the following to your css file
.site-content .entry-header, .site-content .entry-content, .site-content .entry-summary, .site-content .entry-meta, .page-content { max-width: 100% !important; }April 15, 2015 at 4:42 am #161089In reply to: What is up with my IP Address in bbPress Forums?
Robin W
Moderatorthat is entirely intentional – it lets keymasters see IP addresses to spot people who might post under several names.
you could hide it with css
.bbp-reply-ip {
display : none !important ;
}or amend line 512 of loop-single-reply
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpresswhere %your-theme-name% is the name of your theme
find
wp-content/plugins/bbpress/templates/default/bbpress/loop-single-reply.php
Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/loop-single-reply.php
bbPress will now use this template instead of the originalthen take out line 51 – you may also need to do this to loop-single-topic
or use a filter to get rid of it
function remove_ip () { $author_ip = '' ; return $author_ip ; } add_filter( 'bbp_get_author_ip', 'remove_ip');April 15, 2015 at 3:42 am #161085In reply to: limited capabilities for roles in a specific forum
Robin W
Moderatorsorry capabilities are forum wide, and lots of code would be needed to make them forum specific.
I can’t immediately think of an alternate solution
April 14, 2015 at 4:19 pm #161081In reply to: limited capabilities for roles in a specific forum
redwolf83
ParticipantThanks, that is very helpful, but it change roles globally. I need it for a specific forum.
- is possible call these actions to an existing role?
- and is possible call them only for a specific forum
I tried this but seems not work…. :/
// BBPRESS ROLES CONFIG FOR SPECIFIC FORUM if ( bbp_forum_title(); == "My Forum Title" ) { function add_role_caps_filter( $caps, $role ) { /* Only filter for roles we are interested in! */ if( $role == 'participant' ) $caps = custom_capabilities( $role ); return $caps; } add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 ); function custom_capabilities( $role ) { switch ( $role ) { /* Capabilities for 'tutor' role */ case 'participant': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' => false, // Forum caps 'publish_forums' => false, 'edit_forums' => false, 'edit_others_forums' => false, 'delete_forums' => false, 'delete_others_forums' => false, 'read_private_forums' => false, 'read_hidden_forums' => false, // Topic caps 'publish_topics' => false, 'edit_topics' => false, 'edit_others_topics' => false, 'delete_topics' => false, 'delete_others_topics' => false, 'read_private_topics' => false, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => true, 'delete_others_replies' => false, 'read_private_replies' => false, // Topic tag caps 'manage_topic_tags' => false, 'edit_topic_tags' => false, 'delete_topic_tags' => false, 'assign_topic_tags' => false, ); break; default : return $role; } } }April 14, 2015 at 2:13 pm #161079In reply to: limited capabilities for roles in a specific forum
Robin W
ModeratorApril 14, 2015 at 1:25 am #161068In reply to: How to add create new topic button and….
sina_mech
ParticipantThank you for your reply. I have “bbpress” folder in MY_THEME folder. I added a functions.php file in that bbpress folder, and inserted your code, and saved. but nothing happened 🙁 Am I doing it right?
-
AuthorSearch Results