Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add Category field to Buddypress Activity

  • @calvinorenda

    Participant

    Hi all, my goal is to allow users to select category to the updates they made.
    So far this is what I have done in functions.php of my child theme http://pastebin.com/JEhfKPGn

    I understand that since the form submitted passed through global.js, hence i could not grab the category in mysql returned null, as mentioned in previous support post here.

    But the solution there require tempering with the core files. How to add jquey in functions.php in the ‘bp_activity_post_form_options’ to make this work? Not good with jquery and js.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • @modemlooper

    Moderator

    You only need two functions now, there was some fixes added recently to make this easier.

    function my_custom_activity_meta_stuff( $content, $user_id, $activity_id ) {
    	bp_activity_update_meta( $activity_id, 'bpcat', $_POST['bpcat'] );
    }
    add_action( 'bp_activity_posted_update', 'my_custom_activity_meta_stuff', 10, 3 );
    
    function add_bpcat_form_func(){
      $output ='
    	<div id="bpcat">
    		<select name="bpcat" id="bpcat">
    		  <option value="" disabled selected>Choose a Category</option>
    		  <option value="update">Update</option>
    		  <option value="news">News</option>
    		  <option value="video">Video</option>
    		  <option value="image">Photo</option>
    		  <option value="advertisement">Advertisement</option>
    		</select>
    	</div>
    ';
    
      echo $output;
    }
    add_action('bp_activity_post_form_options', 'add_bpcat_form_func');

    @calvinorenda

    Participant

    It is still not working after changing to your code. Seems like it is unable to capture the value of $_POST[‘bpcat’] and update to the database.

    bpcat is still stored as NULL in the mysql database.
    I am using the latest buddypress and wordpress.

    again my full code http://pastebin.com/MBNcn2pe

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add Category field to Buddypress Activity’ is closed to new replies.
Skip to toolbar