Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

what "pm" files are used in edit user profile?

Quote Reply
what "pm" files are used in edit user profile?
I have decided to attempt the next step of the "You've got mail" plug-in. I would like users to be able to select one of 5 greetings for their e-mail alert. To achieve this, I have been editing the user_profile_basic template and added the necessary radio options. Please see the attached screen shot.

In the gforum_user table, I added the variable 'email_greet'

I now need to get the forum user_profile_basic to update that field in the table based on the user's selection...

To achieve this, I need to find the pm file that includeds the necessary code to assign values to the table. User.pm handles some of these items, but not all. Specifically, I would like to see the sections that process the user_yahoo and user_icq fields. I think those would be better suited for this need.

Once the table was being updated, your code in the category_view page would look like:

<%if current_user_new_messages%> <embed src="http://www.yoursite.com/sounds/<%email_greet%>" autostart=true hidden=true loop=false>
<%endif%>
Quote Reply
Re: [shiner] what "pm" files are used in edit user profile? In reply to
If I am not completely mistaken, Jason has designed this in a very clever way:

You can add custom fields ti the User table. All those fields will automatically get updated when a user updates his/her profile. The only thing you have to do is put the correct html in the user_profile_basic template. Mainly, the name of your radio buttons has to be 'email_greet' and the values have to be the things which you want in your database.

So, no messing with the code. Does that make sense?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] what "pm" files are used in edit user profile? In reply to
I tried that - because I thought the same thing - it is a form, and on submit it updates the table. Unfortunatly, I did not get the desired response to my table. no errors, but the table did not update.
Quote Reply
Re: [shiner] what "pm" files are used in edit user profile? In reply to
Here is what I added:

<tr>
<td align=right>
Select Your E-mail Greeting:<br>
</TD>
</tr>
<%GForum::Config::tpl_get(email_greet)%>

<tr>
<td align=right>
<input type="radio" name="email_greet" value="mail44.wav">
</td>
<td><a href="http://www.investingdd.com/sounds/mail44.wav">Carl Carlson: You've got mail, baby</a></td>
</tr>

<tr>
<td align=right>
<input type="radio" name="email_greet" value="mail38.wav">
</td>
<td><a href="http://www.investingdd.com/sounds/mail38.wav">Rosie the Robot (Jetsons): Mail call!</a>
</td>
</tr>

<tr>
<td align=right>
<input type="radio" name="email_greet" value="mail4.wav">
</td>
<td><a href="http://www.investingdd.com/sounds/mail4.wav">The sound of a mail
box door being opened and a woman saying &quot;You've got mail.&quot;</a></td>
</tr>

<tr>
<td align=right>
<input type="radio" name="email_greet" value="mail21.wav">
</td>
<td><a href="http://www.investingdd.com/sounds/mail21.wav">David Letterman: Congratulations Skippy, you've got mail.</a></td>
</tr>

<tr>
<td align=right>
<input type="radio" name="email_greet" value="mail7.wav">
</td>
<td colspan=2><a href="http://www.investingdd.com/sounds/mail7.wav">Homer Simpson: The
mail! The mail is here!</a></td>
</tr>
Quote Reply
Re: [shiner] what "pm" files are used in edit user profile? In reply to
Well, looking at the code in GForum/User.pm, you can see on lines 275 - 280 that it should actually do what I was saying.

Are you sure there is nothing wrong with the HTML, and that the field is defined correctly?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] what "pm" files are used in edit user profile? In reply to
It sounds logical to me that it would be able to handle any new additions.

I think the HTML code is right...

for the variable email_greet, here are my settings:

type: varchar

length/set: 25

attributes: (left blank)

null: null

default: mail4.wav

extra: (left blank)
Quote Reply
Re: [shiner] what "pm" files are used in edit user profile? In reply to
Shouldn't:

<%GForum::Config::tpl_get(email_greet)%>


be:

<%GForum::Config::tpl_get($email_greet)%>


?
Quote Reply
Re: [Paul] what "pm" files are used in edit user profile? In reply to
What is
<%GForum::Config::tpl_get(email_greet)%>
for anyway?

I've added a ton of user fields to my forum-- and all of them update automatically without any code changes, I just copied the HTML from the other fields. Did you create the new column through Gossamer?


Realiiity.com Forums
Quote Reply
Re: [ellipsiiis] what "pm" files are used in edit user profile? In reply to
The documentation in config.pm states that this line is " Useful to bring one or more variables into the templates." I would eventually like the radio buttun of their current greeting to be active -- just like your current user icon radio button being active - also the default value of the field should start "selected."

I guess it is easier than originally thought. I will re-look my html there and see if that is the problem. I will also toy with other field types in the table in case varchar is not suitable.

Last edited by:

shiner: Jun 21, 2002, 2:50 PM
Quote Reply
Re: [Paul] what "pm" files are used in edit user profile? In reply to
Paul - thanks - I did miss that. It did not raise any flags yet because I have not gotten to that phase yet of having it assign the users current preference as the selected item. I have to work those if statements out.

thanks for saving me some unneeded headaches!
Quote Reply
Re: [ellipsiiis] what "pm" files are used in edit user profile? In reply to
ellipsiiis,

I figured out my problem. You were right on in asking if I was creating the variables through gossamer. I was going through mysqlman to directly add the field to the table. When you go through the forum admin panel to add the fields, it automaticly adds the required mysql statements to the user.pm file that result in your form data being saved to the table.

Thanks for pointing me in the right direction!

Last edited by:

shiner: Jun 24, 2002, 6:41 AM
Quote Reply
Re: [shiner] what "pm" files are used in edit user profile? In reply to
Ok - I am close to wrapping this one up - thanks to all who have chimed in to help!

I have the form updating the table - just can not get the file to play now that the variable is inplace. If you hard code the sound file - no problems.

First, I created two new fields via the gforum admin panel

play_email_greet (integer - yes or no option for people to decide if they want an audible greeting)

email_greet (integer option number -- I renamed the files 1.wav, 2.wav, 3.wav ...)




Here is the problem - should be simple to solve...

in category_list.html - I have my if/then set up to play the sound.

<%GForum::Config::tpl_get(play_email_greet, email_greet)%>
<%if play_email_greet%>
<%if current_user_new_messages%>
<embed src="http://www.investingdd.com/sounds/<%email_greet%>.wav" autostart=true hidden=true loop=false>
<%endif%>
<%endif%>

However - nothing happens - when one views the source code in the browser:

1) I actually mispoke earlier when I agreed with paul that it needs $ here -
<%GForum::Config::tpl_get($play_email_greet, $email_greet)%>

This actually does not cause a page error, but one receives this in the page source:
<embed src="http://www.investingdd.com/sounds/Unknown Tag: 'email_greet'.wav" autostart=true hidden=true loop=false>

2) same error results if you remove the <%GForum::Config::tpl_get(play_email_greet, email_greet)%>
line.

3) if you simply have <%GForum::Config::tpl_get(play_email_greet, email_greet)%> line - here is the new code that is generated:

<embed src="http://www.investingdd.com/sounds/.wav" autostart=true hidden=true loop=false>

almost as if it is returning a null value... I checked the table again and there are non-null values in there....

Any tips on returning the correct number?