Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 07:32 am EST
Geeklog Forums
Story user variable
Anonymous
Anonymous
I am trying a cool hack, but i cannot seem to find a variable. I am looking for the email address of the person that submitted the story. So when i submit this story, and i am a registered user, then i should technically have an email address, well i want to find out what the email address is of the person posting (that one story), and use it elsewhere in the code.
6
2
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The email address is not available as a variable. When you sign up with a Geeklog site, it tells you that your email address will never be publicly displayed on the site - and we mean that.
You could easily hack this into COM_article() yourself, though. Or maybe you could tell us what you're trying to do and we may be able to offer a better alternative.
bye, Dirk
4
4
Quote
Anonymous
Anonymous
I have already set up all the code so that when a person posts a new comment the author of the story will get an email with the new comment. Now all i am missing is the email address from the user who posted the original story. I figured it somewehere along the lines of fetching an array from the database returning 'mail' but i'm not sure how to check if the mail address is that of the person who posted the original story. am i looking at uid? and comparing it to the author of the story?
thanks
4
4
Quote
Anonymous
Anonymous
I meant sid... so i go DB-query the story table for the sid, then return related uid withthat story and query the database for the email of the uid??
Im frying my brain over how to code all this...so any help is greatly appretiated...
5
5
Quote
Anonymous
Anonymous
See, how do u search a table for a value, say sid, then return uid, and then search another table for the uid, and return the mail that is on that same row???
5
4
Quote
Anonymous
Anonymous
Now, does anyone see a flaw... or mistake??
// Send an email to the person who wrote the story notyfiyng the comment's text
$result = DB_query("SELECT uid FROM {$_TABLES['stories']} WHERE sid = '$sid'"
$nrows = DB_numRows($result); //check if there is at least one entry
if ($nrows == 1) {
$A = DB_fetchArray($result);
$result = DB_query("SELECT email FROM {$_TABLES['users']} WHERE uid = '$A'"
$B = DB_fetchArray($result);
}
7
5
Quote
Anonymous
Anonymous
Silly ME....
$result = DB_query("SELECT uid FROM {$_TABLES['stories']} WHERE sid = '$sid'"
$nrows = DB_numRows($result); //check if there is at least one entry
if ($nrows == 1) {
$A = DB_fetchArray($result);
$userid = $A[0];
$result = DB_query("SELECT email FROM {$_TABLES['users']} WHERE uid = '$userid'"
$B = DB_fetchArray($result);
}
5
5
Quote
Anonymous
Anonymous
You should be able to do this with one database query. Combine your selects.
4
4
Quote
All times are EST. The time is now 07:32 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content