[wp-hackers] Creating / Inserting into Table named after WP Username
Gregory Lancaster
greglancaster71 at gmail.com
Mon Aug 26 19:33:56 UTC 2013
I should add, that the on page form used to submit this information is used
multiple times for dated information input. So if I use one table rather
than a table for each user_id then every row (and every button submit)
needs to grab the user-ID and input that with the form information so it
can be extracted. Thats why I was opting for table names prefixed with the
user-id rather than rows with a user ID column.
On Mon, Aug 26, 2013 at 12:28 PM, Gregory Lancaster <
greglancaster71 at gmail.com> wrote:
> OH I understand what you're asking.
>
> I want to pass the User_ID to the new table upon registering because I am
> coding this for a profile page of sorts. So after registering, and
> confirming registration they will load up say site.com/profile which will
> dynamically pull their information from a separate table using their
> user_id. From that page they can enter different information that would be
> saved in this separate database (for each user).
>
> So the extra information they will be adding does not need to be added
> right away, however to load the profile page with their display_name and
> basic information I do need the information passed. Now that you bring it
> up however, I suppose I could have the profile page just check if the
> current user_id exists, and if yes then show the basic profile page with
> just their display_name etc. But either way, once they enter information
> into the on page form and submit it, the user-ID needs to be passed.
>
> Which is where I came up with passing the current user ID, since they
> would already be logged in and registered. Really most of the questions I
> asked in this thread are variations of "how can I take the user_id and pass
> it to a separate database upon registration (or upon form submit) so the
> information in their specific table can be dumped back on their profile
> page for viewing.
>
> The information will (ideally) be outputted into a format where I could
> format it with google charts or some type of visual display for them.
>
> I hope that clarifies man, and again I am new to the loop so I apologize
> if I am driving anyone insane here. Any advice welcome :)
>
>
> On Mon, Aug 26, 2013 at 12:17 PM, J.D. Grimes <jdg at codesymphony.co> wrote:
>
>> On Aug 26, 2013, at 3:06 PM, Gregory Lancaster <greglancaster71 at gmail.com>
>> wrote:
>>
>> > When you say on the fly, you mean (for example) when a user registers,
>> have
>> > the user ID copied over into a sep database? That is actually what I am
>> > trying to figure out haha. Id like to have the user->ID copied into a
>> > separate database row *(or create a new table with the user-ID as the
>> table
>> > name)* after registration. If I could figure that out then I imagine the
>> > rest would fall into place for me. The WP loop is something I am still
>> > learning, so I really appreciate the reference information *Nicholas. *
>> >
>> > *J.D* - Is that what you meant? Did I understand your question
>> correctly?
>> >
>> > if current_user->ID if exists fetch array($result) echo $row[1] etc...
>>
>> Not exactly what I mean. My question was why are you copying the user_ID
>> over at that time - but that may not really be important.
>>
>> If you need to add some information do the database when a user
>> registers, then you wan to use the user_register action hook as Nicholas
>> said.
>>
>> http://codex.wordpress.org/Plugin_API/Action_Reference/user_register
>>
>> But in your function hooked to that hook, you do *not* want to use the ID
>> of the current user. You need to use the ID of the user that has just
>> registered, which will be passed as the first parameter to your hooked
>> function, as shown in the examples there.
>>
>> Back to my question, though, I'm not sure why you feel you need to do
>> this at the time the user registers. I assume that it has something to do
>> with the date/time oriented aspect of the data that you want to store?
>> I.e., I guess you have some entries that need to go in at that time so they
>> will be dated properly? But you are going to have to do this differently
>> for registered users...
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> On Mon, Aug 26, 2013 at 12:17 PM, J.D. Grimes <jdg at codesymphony.co> wrote:
>
>> On Aug 26, 2013, at 3:06 PM, Gregory Lancaster <greglancaster71 at gmail.com>
>> wrote:
>>
>> > When you say on the fly, you mean (for example) when a user registers,
>> have
>> > the user ID copied over into a sep database? That is actually what I am
>> > trying to figure out haha. Id like to have the user->ID copied into a
>> > separate database row *(or create a new table with the user-ID as the
>> table
>> > name)* after registration. If I could figure that out then I imagine the
>> > rest would fall into place for me. The WP loop is something I am still
>> > learning, so I really appreciate the reference information *Nicholas. *
>> >
>> > *J.D* - Is that what you meant? Did I understand your question
>> correctly?
>> >
>> > if current_user->ID if exists fetch array($result) echo $row[1] etc...
>>
>> Not exactly what I mean. My question was why are you copying the user_ID
>> over at that time - but that may not really be important.
>>
>> If you need to add some information do the database when a user
>> registers, then you wan to use the user_register action hook as Nicholas
>> said.
>>
>> http://codex.wordpress.org/Plugin_API/Action_Reference/user_register
>>
>> But in your function hooked to that hook, you do *not* want to use the ID
>> of the current user. You need to use the ID of the user that has just
>> registered, which will be passed as the first parameter to your hooked
>> function, as shown in the examples there.
>>
>> Back to my question, though, I'm not sure why you feel you need to do
>> this at the time the user registers. I assume that it has something to do
>> with the date/time oriented aspect of the data that you want to store?
>> I.e., I guess you have some entries that need to go in at that time so they
>> will be dated properly? But you are going to have to do this differently
>> for registered users...
>> _______________________________________________
>> 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