Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding a link (button) on member directory page


  • djmazi12
    Participant

    @djmazi12

    Hi

    I have recently bought the Profile builder pro and i wanted to have a button in the bottom of the members directory that links to another page – so the admin can create users on the front end.

    But i don’t know how to add this button, since when i make changes under pages –> members directory
    nothing shows.
    Can you help or guide me in the right direction?

    I am using theme: Woffice
    Wordpress version: 4.7.2
    Buddypress version: 2.7.4

Viewing 9 replies - 1 through 9 (of 9 total)
  • Page Builders are not be compatible with BuddyPress (at least, I don’t know of any support).
    You would need to manually edit the template files. If you know basic CSS/HTML/PHP, I can give you some instructions and link to some docs.


    djmazi12
    Participant

    @djmazi12

    Hi Paul

    Sounds great. Yes i know how to some basic HTML and CSS – not very good at PHP. But where would i have to edit this file? Am i right if its in the child theme, so it won’t be overwritten when i update?


    djmazi12
    Participant

    @djmazi12

    See my comment. Forgot to do it as a reply.

    Go to /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/. The four files — activate, index, members-loop, and register — are templates used for the Members Directory. Ignore the single subfolder; that’s used for individual member pages.

    You will want the index.php file.

    In your theme, create a buddypress/members subfolder. e.g. /wp-content/themes/my-theme/buddypress/members/. You’ll need to create both directories if they’re missing. Copy that index.php we found earlier into this new directory.

    e.g. you’ll end up with /wp-content/themes/my-theme/buddypress/members/index.php. You’ll want to play around in this file to find where you want to add your custom CSS, which I’ll leave to you to figure out.


    djmazi12
    Participant

    @djmazi12

    Hi Paul

    Thanks a lot for your help. 🙂

    I tried your suggestion, however the members directory look now changed. However i was able to insert my html/css, so that is good. What would i have to do in order to keep the look it was before and still be able to insert my html/css? I tried just inserting my html in the original folder, but it doesn’t seem to show.

    You might be running a theme with BuddyPress-specific files. Have a hunt around your theme, look for a similar structure. etc


    djmazi12
    Participant

    @djmazi12

    Hi Paul

    You’ve been a great help!

    I managed to find the correct buddypress index file.

    If it isn’t too much I would like your help to one last thing.
    So i created my div, however i want it to be visible to only the administrator.

    I found a code i can use:

    <?php
    if (current_user_can(‘edit_users’)){
    ?>
    <div class="opretbruger">Opret bruger</div>
    <?php
    }
    ?>

    however it doesn’t seem to work – it simply hides the div for every user even though my administrator role has the right to edit users. I also tried with ‘administrator’. Am i doing anything wrong?

    Nice work! That looks like it ought to work. Assuming you’re logged in. Assuming that user has that capability.

    Have you tried adding text or something just output that PHP block, to double-check your edited template is actually being used? You might be touching the wrong file.

    Failing that, it might be output, but just hidden by your theme’s CSS? Have you checked for this element inside the web browser’s inspector tools, have you found it?

    Alternatively, you could use this code, but I don’t see why it would make any difference:

    
    <?php if ( is_super_admin() ) : ?>
      <div>hello world</div>
    <?php endif; ?>
    

    ^ That slightly different syntax for PHP in these template files (note the {} are gone) makes the file slightly more readable/less prone to be accidentally broken.


    djmazi12
    Participant

    @djmazi12

    Paul you are the man!

    I have no idea either why that would work, however it did!
    Thank you so much for your help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Skip to toolbar