Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 9,501 through 9,525 (of 32,511 total)
  • Author
    Search Results
  • #158281
    Robin W
    Moderator

    Hmmm.. I’ve just spent some time playing with this code, and it’s not really working.

    It is quoted in lots of sites inc http://gawainlynch.com/customising-dynamic-roles-in-bbpress-2-2/

    But as far as I can see you get the member role, but the site default role capabilities – can’t work out why at the moment. What is you site default, and would that make sense?

    #158276
    elucidateTX
    Participant

    Thank you again for your time on this. I’m not a coder, and I don’t really feel like I have any idea what I’m doing here. But I tried to follow your instructions. Here’s what I did:
    1. I downloaded the functions.php file from my theme folder and opened it to edit in Notepad++
    2. I inserted the code you have above and then did a find/replace. I found first_name and replaced it with rpi_label1. I did the same for last_name and rpi_label2
    3. Here is the resulting code:

    //* Code addition for bbP Profile Information Plugin
    add_action(‘register_form’,’myplugin_register_form’);
    function myplugin_register_form (){
    	$rpi_label1 = ( isset( $_POST[‘rpi_label1’] ) ) ? $_POST[‘rpi_label1’]: ”;
    	$rpi_label2 = ( isset( $_POST[‘rpi_label2’] ) ) ? $_POST[‘rpi_label2’]: ”;
    	?>
    	<p>
    	<label for=”rpi_label1”><?php _e(‘First Name as people call you eg Dave’,’mydomain’) ?><br />
    	<input type=”text” name=”rpi_label1” id=”rpi_label1” class=”input” value=”<?php echo esc_attr(stripslashes($rpi_label1)); ?>” size=”25″ /></label>
    	</p>
    	<p>
    	<label for=”rpi_label2”><?php _e(‘Last Name’,’mydomain’) ?><br />
    	<input type=”text” name=”rpi_label2” id=”rpi_label2” class=”input” value=”<?php echo esc_attr(stripslashes($rpi_label2)); ?>” size=”25″ /></label>
    	</p>
    	<?php
    }
    
    add_filter(‘registration_errors’, ‘myplugin_registration_errors’, 10, 3);
    function myplugin_registration_errors ($errors, $sanitized_user_login, $user_email) {
    	if ( empty( $_POST[‘rpi_label1’] ) )
    	$errors->add( ‘rpi_label1_error’, __(‘ERROR: You must include a first name.’,’mydomain’) );
    	if ( empty( $_POST[‘rpi_label2’] ) )
    	$errors->add( ‘rpi_label2_error’, __(‘ERROR: You must include a last name.’,’mydomain’) );
    	return $errors;
    }
    
    add_action(‘user_register’, ‘myplugin_user_register’);
    function myplugin_user_register ($user_id) {
    	if ( isset( $_POST[‘rpi_label1’] ) )
    	update_user_meta($user_id, ‘rpi_label1’, $_POST[‘rpi_label1’]);
    	if ( isset( $_POST[‘rpi_label2’] ) )
    	update_user_meta($user_id, ‘rpi_label2’, $_POST[‘rpi_label2’]);
    }
    

    Unfortunately it doesn’t seem to be working. I got an error code that reads:
    Parse error: syntax error, unexpected ‘Name’ (T_STRING) in functions.php on line 119

    Line 119 reads:
    <label for=”rpi_label1”><?php _e(‘First Name as people call you eg Dave’,’mydomain’) ?><br />

    Any further help you can provide would be really appreciated.

    #158272
    kc9wwh
    Participant

    Hello Everyone,

    So I’ve been working to get some custom permissions setup for our site and are running into some issues…I’ve followed the document located here and in turn have added the following code to my functions.php file in my child theme:

    //code to add members and board roles
     
    function add_new_roles( $bbp_roles )
    {
        /* Add a role called member */
        $bbp_roles['bbp_member'] = array(
            'name' => 'Member',
            'capabilities' => custom_capabilities( 'bbp_member' )
            );
     
        /* Add a role called board */
        $bbp_roles['bbp_board'] = array(
            'name' => 'Board Member',
            'capabilities' => custom_capabilities( 'bbp_board' )
            );
     
        return $bbp_roles;
    }
     
    add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 );
     
    function add_role_caps_filter( $caps, $role )
    {
        /* Only filter for roles we are interested in! */
        if( $role == 'bbp_member' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_board' )
            $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 'Member' role */
            case 'bbp_member':
                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'   => true,
                    'read_hidden_forums'    => false,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
     
                /* Capabilities for 'Board Member' role */
            case 'bbp_board':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => true,
                    'throttle'              => true,
                    'view_trash'            => false,
     
                    // Forum caps
                    'publish_forums'        => true,
                    'edit_forums'           => true,
                    'edit_others_forums'    => true,
                    'delete_forums'         => true,
                    'delete_others_forums'  => true,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => true,
     
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => true,
                    'delete_topics'         => true,
                    'delete_others_topics'  => true,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => true,
                    'delete_replies'        => true,
                    'delete_others_replies' => true,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => true,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                break;
     
            default :
                return $role;
        }
    }

    The problem I am running into is that the bbp_member role can’t seem to read and private topics, even though I have that capability set to true…? The bbp_board role works just as expected and in playing with the bbp_member role it seems to come down to the “moderate” capability…which I really don’t want on for our regular members.

    Any help on this would be greatly appreciated.

    I have the latest versions of WP, bbPress and BuddyPress installed.

    Thank you

    #158267
    Robin W
    Moderator

    Sorry, using css don’t know how to do that. As before it would I think involve a rewrite of the function bbp_reply_author_link

    And lastly, how to modify the css so that I can display the role as its displayed here on this website, ie., role covered in a box.

    just add

    background-color : green ;

    to your

    #bbpress-forums div.bbp-forum-author .bbp-author-role-admin,
     #bbpress-forums div.bbp-topic-author .bbp-author-role-admin,
     #bbpress-forums div.bbp-reply-author .bbp-author-role-admin { etc
    

    code above

    #158264
    –Q–Shadows
    Participant

    No worries, you took time to even respond is good enough for me.

    Anyways, I played a little bit with css and was able to color the forum roles by adding this is my css file –

    ‘#bbpress-forums div.bbp-forum-author .bbp-author-role-admin,
    #bbpress-forums div.bbp-topic-author .bbp-author-role-admin,
    #bbpress-forums div.bbp-reply-author .bbp-author-role-admin {
    color:red;
    font-size:14px;
    font-family:lucida sans unicode, lucida grande, sans-serif;line-height:1;
    } ‘
    and different colors for different roles by adding the role name at the end (instead of admin).

    Now the issue I am running into is with this –
    ‘ #bbpress-forums div.bbp-topic-author a.bbp-author-name
    #bbpress-forums div.bbp-reply-author a.bbp-author-name {
    clear: left;
    display: block;
    color:red;
    } ‘

    Using this code I am able to change the color of Usernames too, but unfortunately its applied globally and am not much familiar with bbpress to know exactly how to make it role wise. Is there anything that can be added to the above code that would make it apply depending on the role of that author.

    And lastly, how to modify the css so that I can display the role as its displayed here on this website, ie., role covered in a box.

    Would really appreciate if you could at the very least guide me in a proper direction.

    Cheers.

    #158251

    In reply to: Log In Problems

    don5999
    Participant

    Thanks Robin, I’m grateful for all your help.

    Check Email
    The test email has been sent by WordPress. Please note this does NOT mean it has been delivered. See wp_mail in the Codex for more information. The headers sent were:
    MIME-Version: 1.0\r\n
    From: ******@*************.***\r\n
    Content-Type: text/plain; charset=”UTF-8″\r\n

    However, nothing is received at the email address in eith er inbox or junk :0(

    #158249

    In reply to: Layout in progress

    peter-hamilton
    Participant

    Hi Q-Shadows

    It is quite a list of plugins, some hardcoded into my child theme, others just as plugins.

    Plugins Installed

    BBpress
    Rewrote most of the template files

    Buddypress
    Version 2.1.1, tried updating yesterday but broke my site so have to rewrite my plugins before updating

    BBpress Like Button
    Likes for forums

    BP Profile Widgets
    To show a music or video player on members profile

    Buddypress Activity Plus

    Buddypress Like
    For activity likes

    BuddyPress Activity Stream Bump to Top
    Liked and commented activity goes to top of list

    Buddypress Upload Avatar Ajax
    To allow avatar upoad during registration

    Front-End Publishing
    So members can write blogs without multisite activated

    GD bbPress Attachments
    For forum image uploads

    BP Profile as Homepage
    All links to a user links to profile page instead of user activity

    Post rating

    WanGuard

    And I have a few plugins hardcoded into my child theme, not sure about the names

    BuddyPress Group Customizer Lite
    For group backgrounds

    User Signature
    For a signature on forum posts

    Easy View count
    displays views count on single-topic-list

    BP custom background for user profiles
    Or something like that to recreate the facebook/twitter function

    And I added a lot more functions that I found through other members on these forums that have been added to my Functions.php etc.
    Theme had had a lot of alterations since my last visit and is almost finished, have a look.

    Onlijn.com

    Peter Hamilton

    #158248
    Robin W
    Moderator

    no it can be done by this

    so

    create a post (you’ll delete this after, this is just temporary) and put what you want in the content, including nay images, and get it looking like you want it. you can’t have any single quotes (‘) but can have double quotes (“).

    Then switch to ‘text’ view – top right of the content box. This will take you into html mode, and the ‘code’ we need will be there.

    Copy all this code into the $content = bit in the code above. It must have a ‘ at either end, and a ; at the end so you will end up with

    $content = ‘ whatever the text you copied is in here ‘ ;

    then save and upload, and delete the post when you are happy it works.

    Come back if any of that doesn’t work, and if you do and are happy to make it public let me know what you have pasted in there so I can make sure it’s right

    #158247
    Skrollen
    Participant

    Cool, thanks!

    If possible I would like to add a bit more than just a line of content. Like a paragraph of text (like 50 Words) and an image or two. Is there any way to do this through code, or perhaps by being able to insert a text widget?

    crystalleeanne
    Participant

    Okay, this topic gets me part of the way there…
    Can someone please help me figure out how to modify this filter code to create placeholder text for the bbPress login form widget? (Username and Password fields).

    #158231

    In reply to: Log In Problems

    don5999
    Participant

    Yes, it has that shortcode.

    a) I have no idea if it is sending – I havent set anything up email wise
    b) I have tried my business email and personal email addresses and its not receiving on either
    c) I have looked in both junk folders and nothing in there

    Do I need to set up an external link to email or setting inside of wordpress or bbpress to open my Outlook to send it or should it automatically send through wordpress?

    #158223

    In reply to: Forum Width

    Robin W
    Moderator

    you’ll need to work you way through this article

    Functions files and child themes – explained !

    #158222
    Robin W
    Moderator

    put the following in your style.css

    #bbpress-forums .button {
      background-color: blue;
      color: red;
    }

    Functions files and child themes – explained !

    #158217
    Robin W
    Moderator

    would need a function recoded to do this, as there is a function that does the avatar and role display

    The function is bbp_reply_author_link

    and it’s held in

    bbpress\includes\replies\template.php

    it has a filter you can call, and if you fine with php you should be able to hack the code to change the order

    #158213

    In reply to: Forum Width

    Robin W
    Moderator

    add the following to your style.css

    if you want it on the left but smaller

    #bbpress-forums {
      width: 66% !important;
    }
    

    If you want it centered

    #bbpress-forums {
      margin-left: auto !important;
      margin-right: auto !important;
      width: 66% !important;
    }
    
    

    Functions files and child themes – explained !

    Obviously play with the 66% to get whatever width you want

    #158212
    Robin W
    Moderator

    If it is just one line then add the following to your functions file

    function my_content () {
    	$content = 'Hello this is some content after the topic' ; 
    	echo $content ;
    	}
    	 
    add_action ('bbp_template_after_replies_loop', 'my_content' ) ;

    and change the text to what you want

    Functions files and child themes – explained !

    If it is more than that, then you will need to detail exactly what you want so I can help you.

    #158203

    In reply to: no topics found

    Robin W
    Moderator

    and for

    Also, would like to change that “oh bother” to something less “cutesy”.

    add the following

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'Oh bother! No topics were found here!' ) {
    	$translated_text = 'new text';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );
    

    to your functions file

    Functions files and child themes – explained !

    #158197
    Robin W
    Moderator

    oops sorry didn’t take the ); out of the previous line

    try

    function change_display_name( $user_id ) {
        $info = get_userdata( $user_id );
    	$args = array(
    		'ID' => $user_id,
    		'display_name' => $info->user_login ,
    'nickname' => $info->user_login 	);
    
        wp_update_user( $args );
    }
    add_action('user_register','change_display_name');
    vikingpoker
    Participant

    Using bbpress 2.5.4, wordpress 4.1, buddypress 2.2 http://www.new.stonemagegames.com

    I just started learning all of this so please be patient with me. How come when I make a new forum and it brings up the new page where I can place an image, the image does not appear on the forum page when I click on the forum? I do not understand why this is so complicated. All I want is a banner on the top of the forum page. That’s it. Nothing more… nothing less… I haven’t found any way to do this or make it work. I dont know the proper terminology to use when searching for answers so I am completely lost. I have watched youtube videos and read many posts. My head is about to explode!!!

    I made a page and threw it up in the top menu that says forums. It has a picture on it. My forums are on the side bar and they work fine. Why would they even bother giving me a page to upload media when I create a new forum if it wont even display it? It doesn’t make sense.

    So then I tried using widgetlogic. I have entered every code I can find and nothing makes it display on the page that I put the banner on. All that happens is that my forum list disappears from the sidebar.

    Please tell me that i’m just an idiot and I am overlooking something stupid and simple. Please tell me that it is not this complicated just to have a banner on the top of my forum pages. Please HELP!!!

    #158187
    Robin W
    Moderator

    ok, let’s try setting both

    function change_display_name( $user_id ) {
        $info = get_userdata( $user_id );
    	$args = array(
    		'ID' => $user_id,
    		'display_name' => $info->user_login 	);
    'nickname' => $info->user_login 	);
    
        wp_update_user( $args );
    }
    add_action('user_register','change_display_name');

    This should set both display_name and nickname to the username

    #158186
    Robin W
    Moderator

    Having said that it does appear to be using the username now in the address bar ???

    with my code in, or without?

    #158183
    Robin W
    Moderator

    yes that’s to do with how wordpress stores stuff.

    the code you need to use is in the post above, don’t use the email one !

    Try again and come back !

    #158182
    format19
    Participant

    How odd the code I got in the email is different from the code as pasted here in the forum ????

    https://www.dropbox.com/s/tff64o2g5kan3r4/code%20error.jpg?dl=0

    M

    #158181
    format19
    Participant

    Hi Robin,

    Thanks again for getting back, Not directed at you but that made me mad… >-|
    I posted in the BuddyPress forum before posting here and they saidf it was a bbpress problem…. I have just had a week of various website problems and every one (except yourself) have only been interested in blaming someone else or someone elses plugin and in no way interested in helping fix the problem.

    Rant over…. 🙂
    I tried your code in my functions.php but unfortunatly it broke the site and just kept telling me there was an unexpected & in line 127

    Line 127 was
    ” & # 039 ; display_name' => $info->user_login ) ; ”
    'display_name' => $info->user_login );

    (ah I dont know why it keeps changing what im pasting)

    Any idea what is wrong there?
    Thanks
    Mark

    #158179
    Robin W
    Moderator

    ok, that is buddypress adding the profile fields, so you may need to take it up with them if the next bit doesn’t work !

    However whilst doing something for someone else today, I found a function on the net, which I have amended (but not tested) below

    function change_display_name( $user_id ) {
        $info = get_userdata( $user_id );
    	$args = array(
    		'ID' => $user_id,
    		'display_name' => $info->user_login 	);
        wp_update_user( $args );
    }
    add_action('user_register','change_display_name');
    
    

    then on registration it should set the display_name to the username

    put this in your functions file

    Functions files and child themes – explained !

Viewing 25 results - 9,501 through 9,525 (of 32,511 total)
Skip to toolbar