[wp-hackers] getting user_id in buddypress profile page

mohammad aghanabi 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?
>
> -J.D.
>
> On Oct 5, 2013, at 7:22 PM, BenderisGreat <greglancaster71 at gmail.com>
> wrote:
>
> > 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
> it
> > 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:
> http://wordpress-hackers.1065353.n5.nabble.com/getting-user-id-in-buddypress-profile-page-tp42444.html
> > 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
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list