• Resolved taranakiretreat

    (@taranakiretreat)


    Kia ora Robin
    Thank you for a BRILLIANT awesome plugin. Much respect. I have bought a couple of the extensions, and would like to donate, but the paypal link seems broken?

    Also…. For our usage, we will be creating a LOT of private groups (we’re a small charity that supports people who are suicidal… hence the need for private groups for support). Is there any way to do this with an API call, please? It would make our process a gazillion times easier. I see you’ve included some calls in the plugin for joining people to groups, which is cool – but I also need to create a private group for each new person, and would very much prefer not to have to do that through the ui.

    Yours hopefully and gratefully, Jamie

Viewing 15 replies - 16 through 30 (of 32 total)
  • Plugin Author Robin W

    (@robin-w)

    some people do crosswords, some sudoku – I like getting code to do what it was not intended to do – glad that you are fixed, and able to help others in their lives ??

    Thread Starter taranakiretreat

    (@taranakiretreat)

    Haha!! I FULLY relate!
    Php has always been dark magic to me, though. One day I should get over that and get to grips with it.
    It’s kinda cool when that work of yours saves lives. That’s precisely what it’ll be doing in this case.
    Respect.
    Jamie :))

    Plugin Author Robin W

    (@robin-w)

    ??

    Thread Starter taranakiretreat

    (@taranakiretreat)

    Kia ora Robin
    Sorry, two more requests while I have you… then I’ll leave you alone!
    …and for my apologies for being so high-maintenance… Feel free to say, ‘Enough!’ this point
    ….and for my php ignorance…
    But if possible, please could you very kindly give me a line to add to the script to return group number?
    I’ll need to add a hook to add and remove users from groups down the track, but I think you’ve written on this elsewhere, eh.
    Very gratefully,
    Jamie

    Plugin Author Robin W

    (@robin-w)

    that only looked like one request !! ??

    function rew_add_private_group ($user_id) {
    /***  FIRST ADD A NEW GROUP   ***/
    	//get user and set up username
    	$user = get_userdata($user_id) ;
    	$username = $user->user_login;
    	$fullname = $user->first_name.$user->last_name;
    	//count the number of current user groups and increment by 1
    	$options = get_option('rpg_groups');
    	$count=count ($options)+1 ;
    	//set the group up and called it the $fullname
    	$options['group'.$count] = $fullname;
    	//Update the database
    	update_option('rpg_groups', $options);
    /*** THEN CREATE A NEW FORUM  ***/	
    $forum_data = apply_filters( 'rew_new_forum_pre_insert', array(
    		'post_author'    => $username,
    		'post_title'     => $username.'\'s Journal',
    		'post_content'   => '',
    		'post_parent'    => '',
    		'post_status'    => bbp_get_private_status_id(),
    		'post_type'      => bbp_get_forum_post_type(),
    		'comment_status' => 'closed'
    	) );
    
    	// Insert forum
    	$forum_id = wp_insert_post( $forum_data, true );
    	//and add meta data
    	update_post_meta ($forum_id , '_bbp_forum_id' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_last_topic_id' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_last_reply_id' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_last_active_id' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_last_active_time' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_forum_subforum_count' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_reply_count' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_total_reply_count' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_total_reply_count' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_topic_count' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_topic_count_hidden' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_reply_count_hidden' , 0 ) ;
    	update_post_meta ($forum_id , '_bbp_status' , 'open' ) ;
    	update_post_meta ($forum_id , '_bbp_forum_type' , 'forum' ) ;
    /*** THEN SET THIS FORUM TO JUST HAVE THIS GROUP  ***/	
    	update_post_meta ($forum_id , '_private_group' , 'group'.$count) ;
    /*** AND FINALLY SET THE USER TO BE IN THIS GROUP  ***/	
    	update_user_meta( $user_id, 'private_group', '*group'.$count.'*');
    return $count ;
    }

    so you would call this like this

    $group_number = rew_add_private_group ($user_id);

    this just returns a number if you want the group, then change the return line to

    return 'group'.$count ;

    Thread Starter taranakiretreat

    (@taranakiretreat)

    Legend! Thank you – works perfectly!
    Ae, the other question was more a note to myself to track down where I’d seen your posting on how to add/remove a user to a group…:)

    Jamie :))

    Thread Starter taranakiretreat

    (@taranakiretreat)

    Bro
    Me again!
    ??
    So, we’re sneakily using the Forum notion for those who are accessing support, to Journal (with a journal buddy). One thing which is causing some strife is the drop-down where the user selects the forum. They keep missing this, and not understanding the error message….
    Unless they are members of our team, they only have one forum (‘Their’ journal). I’m just wondering if there’s any way to default that to their ‘journal’ if that’s the only ‘journal’ (forum) that they belong to?
    …A long shot, I know…!
    Thank you again, Jamie

    Plugin Author Robin W

    (@robin-w)

    sorry for delay in replying – I’ll try and look at some code for that

    Plugin Author Robin W

    (@robin-w)

    1. Do you know how to do ftp?
    2. are using a child theme?

    Thread Starter taranakiretreat

    (@taranakiretreat)

    Kia ora Robin
    Thank you so much :)))
    Absolutely yes re ftp (although I way prefer working over ssh, so don’t tend to use ftp if I can avoid it). Certainly am using a child theme, and also have my own custom plugin where I chuck code snippets.
    Yours with utterly grateful thanks again
    Jamie

    Plugin Author Robin W

    (@robin-w)

    we’re sneakily using the Forum notion

    can you explain what you mean by this ?

    Thread Starter taranakiretreat

    (@taranakiretreat)

    ?? I mean we’re using the framework of the Forum concept as a method of our keeping a journal – with a buddy alongside them…
    Jamie

    Plugin Author Robin W

    (@robin-w)

    yeh, but I’m looking for the dropdown code that you are talking about !

    How/where are they seeing this?

    Thread Starter taranakiretreat

    (@taranakiretreat)

    :))) Apologies for my explanation!!

    Immediately below the editor, where they’ve added their post,

    Forum:

    — No Forum — v

    …where you select the Forum you want to post to ??
    Thank you so much again
    Jamie

    Plugin Author Robin W

    (@robin-w)

    no still not where you are.

    So they go into the forums, and see their forum. This displays their forum, and under this is the ability to add a further topic.

    Not sure where they get the ability to choose a forum.

Viewing 15 replies - 16 through 30 (of 32 total)
  • The topic ‘API: Create Private Group’ is closed to new replies.