Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)

  • dlongm01
    Participant

    @dlongm01

    Update: the issue is with the bbPress plugin and XTheme. Issue has been added to XTheme bugfix list.


    dlongm01
    Participant

    @dlongm01

    Thanks modemlooper. I’m a bit of newbie and, now you point it out that’s a simple and good test.

    Really helpful and guess what: the link box styling works fine!!

    Back to the theme developers! (I’m using XTheme).

    Cheers


    dlongm01
    Participant

    @dlongm01

    Thanks Henry – that makes sense. I checked and yes it’s true the particular user has never logged in!


    dlongm01
    Participant

    @dlongm01

    Ah! I just realised that the user in question has never been active!

    I assume that explains the search failure?


    dlongm01
    Participant

    @dlongm01

    OK – thanks – that seems simple enough. I just thought that the role name might be part of the user data.

    I can manage that though.

    Cheers

    🙂


    dlongm01
    Participant

    @dlongm01

    Hi Shane – one last question.

    I just realised that function gets the role ID not the role name.

    So I get the role ID ‘senior-fellow’ rather than the role name ‘MirandaNet Senior Fellow’

    I looked at the codex (various searches on ‘display role name’ or ‘get role name’) but can’t quite figure out what it’s telling me.

    This is not a crucial issue, but nice if it is simple to display the name rather than the ID.

    Thanks

    PS I realise that my original question referred to roles rather than names. I’ve only just noticed the important difference!


    dlongm01
    Participant

    @dlongm01

    Thank you ShaneBP. That’s marvellous. Does exactly what I want. Your help is very gratefully acknowledged.

    Here’s my final code. The echo line formats and capitalises the role name:

    function dlongm_show_role() {
        $user = get_userdata( bp_displayed_user_id() );
            $userole = $user->roles[0];
                echo "<span style='color:#9e152c;font-size:14pt;'>".ucwords($userole)."</span>";
           
    }
    add_action( 'bp_before_member_header_meta', 'dlongm_show_role' );

    I learned a little more about PHP too which is a bonus. I always twitch when I add PHP to my functions file because even trivial simple syntax errors can crash a site (no semi-colin, missin bracket etc.) Luckily I have a dev site and FTP access so I can get at the functions file if things go wrong – which happend several times!


    dlongm01
    Participant

    @dlongm01

    Thanks Shane

    Sorry – I am a real novice here ask you to indulge me.

    I have tried this inside the code you already gave me but it does not work. I guess I don’t know the correct syntax for the If statement, or I do not know how to name the role. E.g. I want to exclude bbp_spectator so tried this:

    function dlongm_show_role() {
        $user = get_userdata( bp_displayed_user_id() );
    
        if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
            foreach ( $user->roles as $role )
                if ( $role != bbp_spectator) {
        	       echo "$role;
           }
        }
    }
    add_action( 'bp_before_member_header_meta', 'dlongm_show_role' );

    I guess what puzzles me is that the array has clearly got something like this in it:

    adminstratorbbp_spectator

    All I need is the first element of this string or object. I am just not clear about PHP syntax to know how to get it ….

    I appreciate your advice.


    dlongm01
    Participant

    @dlongm01

    Excellent Shane. That looks good.

    I don’t want the bbpress role to show though, just the main user role. Can the bbp role be squelched?

    Thanks


    dlongm01
    Participant

    @dlongm01

    @shanebp I forgot mention that I am talking about editing the member profile on the front end, i.e the member profile page.


    dlongm01
    Participant

    @dlongm01

    OK – I found it:

    /* Buddypress rich text toolbar – hide fullscreen button*/
    .mce-i-fullscreen::before {
    display:none;
    }


    dlongm01
    Participant

    @dlongm01

    In fact I have found a reasonable solution using CSS. I found some key clues on in the support forum for this plugin: Buddypress Xprofile Custom Fields Type (though I’m not using that plugin).

    If anyone has any advice about how to improve this I would be glad to hear it. Thanks

    /* Buddypress profile field description position*/
    .editfield {
    position: relative;
    top: 5px;
    }
    .editfield label {
    font-weight:bold;
    margin-bottom: 30px;
    }
    .input field_4 {
    margin-top: 5px;
    }

    form.standard-form p.description {
    margin: 0 0 15px;
    position: absolute;
    top: 20px;
    line-height:1em;
    }


    dlongm01
    Participant

    @dlongm01

    Thanks for the help @shanebp. However, I am no good with PHP (yet) and still quite new to WP and BP so at the moment not entirely sure what to do with your suggestion.

Viewing 13 replies - 1 through 13 (of 13 total)
Skip to toolbar