SRD75 (@srd75)

Forum Replies Created

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

  • SRD75
    Participant

    @srd75

    It is a basic Divi child theme.


    SRD75
    Participant

    @srd75

    Help appreciated Folks.


    SRD75
    Participant

    @srd75

    Excellent, just what we needed.

    Thanks Robin.


    SRD75
    Participant

    @srd75

    Found it. The new WordPress.org interface had me confused.

    Found the install instructions now.


    SRD75
    Participant

    @srd75

    Thank you Robin.

    I’ve installed and activated the plugin, but can’t find the plugin’s options screen.

    Can you direct me to it please?

    Thanks,
    Steve


    SRD75
    Participant

    @srd75

    Hello anyone?


    SRD75
    Participant

    @srd75

    Hello @nhadsall, can you help please?


    SRD75
    Participant

    @srd75

    Hi. I tried the following code, created a new user, logged in as that user, went to subscriptions, and the user was not subscribed to any forums.

    Was hoping the new user would be subscribed to the single forum that exists.

    Help appreciated.

    Regards,
    Steve

    add_filter( 'bbp_get_user_subscribe_link', 'invert_get_user_subscribe_link', 10, 4 ); //invert forum subscription
    add_filter( 'bbp_is_user_subscribed_to_forum', 'invert_is_user_subscribed_to_forum', 10, 4 ); //invert forum subscription
    add_filter( 'bbp_get_forum_subscribers', 'invert_get_forum_subscribers' ); //invert forum subscription
    add_filter( 'bbp_is_user_subscribed', 'invert_is_user_subscribed', 10, 4 ); //invert forum subscription
    
    function invert_is_user_subscribed($retval, $user_id, $object_id, $subscribed_ids) {
    	if (get_post_type( $object_id ) == bbp_get_forum_post_type())
    		return !$retval;
    	else	
    		return $retval;
    }
    
    function strContains($needle, $haystack) {
    	if (strpos($haystack, $needle) !== false) {
    		return true;
    	} else {
    		return false;
    	}
    }
    
    function invert_get_user_subscribe_link ($html, $r, $user_id, $topic_id) {
    	if (strContains( "bbp_unsubscribe", $html )) {
    		$html = str_replace("bbp_unsubscribe", "bbp_subscribe", $html);
    	} else {
    		$html = str_replace("bbp_subscribe", "bbp_unsubscribe", $html);
    	}
    	return $html;
    }
    
    function invert_get_forum_subscribers( $users ) {
    	$args = array('fields' => 'id');
    	$all_users = get_users($args);
    	$send_to_users    = array_diff($all_users, $users);
    	return $send_to_users;
    }
    
    function invert_is_user_subscribed_to_forum( $retval, $user_id, $forum_id, $subscribed_ids ) {
    	return !$retval;
    }
Viewing 8 replies - 1 through 8 (of 8 total)