[wp-hackers] getting user_id in buddypress profile page
m.websoft at gmail.com
Sun Oct 6 20:31:47 UTC 2013
Please vardump the $userid variable. also try to use bp_displayed_user_id()
for getting user id in a profile.
On Sun, Oct 6, 2013 at 11:54 PM, J.D. Grimes <jdg at codesymphony.co> wrote:
> I don't see anything wrong with that. Try changing it to
> 'user_id' => get_current_user_id(),
> Are you sure that $userid is being set above your insert code?
> On Oct 5, 2013, at 7:22 PM, BenderisGreat <greglancaster71 at gmail.com>
> > This is likely very simple, but I am having an issue with it.
> > I am using
> > <?php
> > global $wpdb, $userdata, $current_user;
> > $current_user = wp_get_current_user();
> > $userid = $current_user->ID;
> > ?>
> > I can echo out $userid and it shows the correct user ID, but when I put
> > into the form submit;
> > $wpdb->insert(wp_jo_plugin_options, array (
> > 'user_id' => $userid,
> > 'length' => $_POST['length'],
> > 'girth' => $_POST['girth'],
> > 'date' => $_POST['date'],
> > it just posts a 0 to the database. Am I doing something wrong here? It
> > seems very straight forward, never had an issue with such a simple task.
> > But trying to add this code to buddypress is a real hassle.
> > --
> > View this message in context:
> > Sent from the Wordpress Hackers mailing list archive at Nabble.com.
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers