Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'buddypress'

Viewing 25 results - 19,201 through 19,225 (of 68,969 total)
  • Author
    Search Results
  • #170628
    shanebp
    Moderator

    Perhaps a simpler way, given that she wants to check for both admin and editor, is to test against a cap that both admin and editor have.

    Something like: `function bp_my_restrict() {

    if ( !current_user_can(‘edit_posts’) ) {

    if ( bp_is_current_component(‘members’) || bp_is_current_component(‘activity’) ) {

    bp_core_redirect( home_url() );

    }
    }
    }
    add_action(‘wp’,’bp_my_restrict’);`

    #170624
    Henry
    Member

    Hi @mossyoak

    I’ve run a few tests and made some slight changes to that code. Try this

    function bp_my_restrict() {
       $user_id = bp_loggedin_user_id(); 
       $user = new WP_User( $user_id );
    	
          
    
             if ( ( $user->roles[0] != 'administrator' ) ) {
    		 
    		 if ( bp_is_current_component('members') || bp_is_current_component('activity')  ) {
                wp_redirect( home_url() );
    	    exit();
    	 }
          }
    }
    add_action('wp','bp_my_restrict');
    #170623
    Squirrel
    Participant

    Hi
    Thanks for your help again
    I tried your function

    function bp_my_restrict() {
       global $bp;
       $user_id = bp_loggedin_user_id(); 
       $user = new WP_User( $user_id );
    	
          if ( bp_is_current_component('members') || bp_is_current_component('activity') ) {
    
             if ( ( $user->roles[0] != 'administrator' ) ) {
                wp_redirect( $bp->loggedin_user->domain );
    	    exit();
    	 }
          }
    }
    add_action('wp','bp_my_restrict');

    But it gave a redirect loop error- I think it is because these conditionals are stopping the profile page being accessed for users lower than admin so trying to redirect to it is just looping.

    I changed the redirect to the home page which stopped the constant loop- but users who are not admin can still not access the profile page- these conditionals are stopping that which is a bit odd.

    // BuddyPress restrict activity and members page
    function bp_my_restrict() {
    global $bp;
    $user_id = bp_loggedin_user_id();
    $user = new WP_User( $user_id );
    
    if ( bp_is_current_component('members') || bp_is_current_component('activity') ) {
    if ( ( $user->roles[0] != 'administrator' ) ) {
    wp_redirect( home_url() ); exit;
    }
    }
    }
    add_action('wp','bp_my_restrict');

    Thank you for your help.

    #170620
    shanebp
    Moderator

    @eflouret
    >Do you think that moving the templates to the main theme is wrong?

    No, it’s what you should do when you want to customize templates.
    I thought you did it solely as part of your attempt to get the new nav item working.

    If you want, you can add new templates to that dir.
    And call a template from your show_content function:

    function show_content() { 
    	locate_template( array( 'buddypress/members/single/my-trips.php' ), true );
    }
    #170618
    Henry
    Member

    Just read through your original question. The code snippet you’d want to add to your theme’s functions.php is something like this:

    function bp_my_restrict() {
       global $bp;
       $user_id = bp_loggedin_user_id(); 
       $user = new WP_User( $user_id );
    	
          if ( bp_is_current_component('members') || bp_is_current_component('activity') ) {
    
             if ( ( $user->roles[0] != 'administrator' ) ) {
                wp_redirect( $bp->loggedin_user->domain );
    	    exit();
    	 }
          }
    }
    add_action('wp','bp_my_restrict');
    #170617
    Henry
    Member

    Try this

    <?php
    
       $user_id = bp_loggedin_user_id(); 
       $user = new WP_User( $user_id );
       
       if ( $user->roles[0] != 'administrator' ) {
         // your code
       }
    
    ?>
    #170615
    Squirrel
    Participant

    There is still a problem though in that if I do this it stops any member who is not an admin level user accessing their profile page. Not sure why it should affect that- tried with just the activity conditional and it stops profile page access as well.

    elseif (bp_is_current_component( 'members' ) || bp_is_current_component( 'activity' )) :
    get_header('restrict');

    I’m using a header-restrict.php which redirects them with this redirect at the very top of it:

    <?php if(!current_user_can('delete_others_pages')) { wp_redirect( home_url() ); exit; } ?>

    Any ideas?

    #170613
    Squirrel
    Participant

    Thanks for your help Henry- I tried the is_page conditional but it does not work with the BuddyPress Pages.

    So I tried bp_is_Page which worked, but was depecated.
    Then I tried
    bp_is_current_component( 'activity' ) || bp_is_current_component( 'members' )
    and they work for what I want.

    Thanks for your feedback it helped a lot 🙂

    Chris

    #170611
    Henry
    Member

    You could use the WordPress conditional is_page() to check if the user is on the activity or members page:

    if ( is_page('members') || is_page('activity') ) {
    
    } else {
    
    }

    Note: I’m assuming you haven’t changed the default slugs

    #170594
    eflouret
    Participant

    Thanks! It worked! I can´t believe that I spent almost four hours trying to figure this out and all I needed was to set the parent slug and url.

    I moved the Buddypress member templates to my theme, inside a directory named Buddypress just because I needed to do some heavy tweaking. This way the templates stay with the main theme and since I uploaded BuddyPress from WordPress control panel, I don´t have permissions to make changes to the templates. I can use the internal wordpress plugin editor, but that would drive me crazy.

    Do you think that moving the templates to the main theme is wrong? Is there a better way to make changes to the templates code? Buddypress template system is like ancient chinese to me.

    Thanks again!

    Enrique

    #170583
    Henry
    Member

    It is easily done. You’d need to create a new page template:

    https://codex.wordpress.org/Page_Templates

    You can then use a modified members loop inside the page template you create:

    Members Loop

    #170577
    Roger Coathup
    Participant
    #170570

    In reply to: Registration Process

    Henry
    Member

    Your theme’s functions.php file wouldn’t get overwritten with each update. The changes you make to this file will be safe going forward.

    A great place to hire a BuddyPress developer would be the BP Jobs Board:

    BP Jobs Board

    #170568

    In reply to: Registration Process

    tayenewm
    Participant

    But wouldn’t I run into the same problem with every theme update? I don’t know code and don’t like diddling in it. Maybe I need to just hire a developer to resolve all my little issues. Does BuddyPress offer dev services? Where do I go to sign up? thanks

    #170556
    bp-help
    Participant

    Please do not make duplicate topics that regards the same subject matter as it clutters the forum. @mercime and @modemlooper has already responded on the first topic here:
    https://buddypress.org/support/topic/charge-a-fee-to-upload-media/
    If their suggestions doesn’t work the only options you have is build this functionality yourself or hire a developer to do it for you. You may want to post on the jobs board:

    BP Jobs Board


    or here:
    http://jobs.wordpress.net/
    Good luck!

    #170545
    studiopeter
    Participant

    I’m having the same issue.
    Is there a solution yet ??

    Regards,
    Peter

    #170526
    bp-help
    Participant

    @megainfo
    Thanks for the info. I will give it a try!

    #170519
    terraling
    Participant

    Sorry @funmi-omoba, I didn’t quite get your question, but here is the code I added to my functions.php based on earlier answers:

    function my_add_friend_link_text($button) {
    	switch ( $button['id'] ) {
    		case 'pending' :
    			$button['link_text'] = 'x Pending';
    			$button['link_title'] = 'Cancel friend request';
    			$button['link_class'] .= ' btn btn-xs btn-warning';
    		break;
    
    		case 'is_friend' :
    			$button['link_text'] = '- Unfriend';
    			$button['link_class'] .= ' btn btn-xs btn-danger';
    		break;
    
    		default:
    			$button['link_text'] = '+ Friend';
    			$button['link_title'] = 'Send friend request';
    			$button['link_class'] .= ' btn btn-xs btn-success';
    	}
    	return $button;
    }
    add_filter('bp_get_add_friend_button', 'my_add_friend_link_text');
    

    I’m changing the link text, changing the title, and adding additional classes (I’m using bootstrap and wanted the buttons styled the same as elsewhere, though that means deleting the generic button styling from buddypress.css)

    Hope that helps.

    #170516

    rtMedia is a huge, massive cluster of bugs. Awful. I have installed and uninstalled it at least 7 times in the last month, trying to give it just one more chance…. Every time I do, I discover a new bug.

    Give BuddyDev’s Gallery plugin a shot. It’s premium ($30 for a 3-month “club” membership), but it’s got actual (if spotty) support – and without the attitude you get from rtMedia’s developers.

    Also – and this is big for me – it includes the ability to embed media, rather than hosting. I really don’t want to be in the video hosting business at this point.

    #170510
    jaemaz
    Participant

    Actually, this functionality is controlled by the BuddyPress Group Email Subscription plugin, but still… anybody? 🙂

    #170505
    meg@info
    Participant

    @bphelp,

    Of course if your try the plugin in buddypress child theme other than the default will not work fine beceause the plugin use the default buddypress template !

    the plugin work with all wordpress themes if the theme use legacy buddypress theme,
    if it is child theme, in this case you must customize the plugin templates by modifying the template files. Just copy buddypress-wall\includes\templates\bp-default folder to your theme and edit the templates.

    A lot of Buddypress plugins present a template and suggest a customisation if the theme is buddypress child themes.

    #170498
    bp-help
    Participant

    @fungi-amoeba @nexus66
    I tried the plugin but it didn’t seem to work on various themes. Also it seems some of the same functionality came from @brajesh ‘s post here:

    Facebook Style Activity Commenting with BuddyPress


    I would like to see this work though on all themes in the future.

    #170495
    Nexus66
    Participant

    Will give it try..

    #170493
    Henry
    Member

    Which premium plugin did you find?

    To make uploading an avatar a requirement you’d have to have an upload form on the registration page. This used to happen in BuddyPress. Some discussion on it in this thread:
    https://wordpress.org/support/topic/plugin-buddypress-avatar-upload-in-registration-form

    #170487

    In reply to: two page home page?

    bp-help
    Participant
Viewing 25 results - 19,201 through 19,225 (of 68,969 total)
Skip to toolbar