• Resolved davist11

    (@davist11)


    I am working on trying to integrate wordpress and bbpress and came across a problem where when people were registering through wordpress, it was not giving them capability to post to the bbpress install. So I created a small plugin that adds the necessary meta key and value for bbpress.
    Here is the plugin code:

    function insertbbPressRole($insert_id) {
    	update_usermeta($insert_id,'bb_capabilities','a:1:{s:6:"member";b:1;}');
    }
    
    add_action('user_register', 'insertbbPressRole');

    But, the value it is actually inserting into the db is
    s:23:"a:1:{s:6:"member";b:1;}";

    It makes no sense at all. I think I have tracked it down that the colons are causing the issue. I tried escaping them, and running various functions on the string before inserting it, but to no avail.

    Anyone know why this is happening?

Viewing 1 replies (of 1 total)
  • Thread Starter davist11

    (@davist11)

    Ok, so I found the solution. I just had to run the string into the maybe_unserialize function and it inserted it correctly.

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with update_usermeta (I think it’s the colons)’ is closed to new replies.