On these pages are my WordPress plugins, the odd article and my Support Forum.

For my random rantings on everything else please visit my blog at Yellow Swordfish

WP Plugins


Articles

If you find any of my plugins useful, please comsider a donation towards my running costs.

Thank you

In preparation for the release of Simple:Press Version 4.0, the Support Forum has moved to a new site dedicated to the plugin. This will also be the future home for Simple:Press Forum.


Version 3.1.4 will still be available for download here in the short term.


For the support forum - and to visit our new site and to get details of version 4.0, click on the logo to take you to simplepressforum.com

This forum is currently locked - access is read only
Current User: Guest
Please consider registering

 
Search Forums:


 




Registration Addition

UserPost

9:55 pm
16 Sep 2008


derrickam

Member

posts 10

1

So I have someone who wants to add name and phone number to their registration collection.  Neither the forum or wordpress needs that info so it just has to end up on the administrators confirmaiton.  Is there a simple way to add that to the code?  I'm guessing I need to add lines similar to this one on the sf-registration.php?:

                    <label><?php _e('Username:', “sforum”) ?><br />
                    <input type=”text” name=”user_login” id=”user_login” class=”sfcontrol” value=”<?php echo wp_specialchars(stripslashes($user_login), 1); ?>” size=”20″ tabindex=”1″ /></label>
                    </p>

But before I start playing with it I don't want to screw up the form as is. 

Thanks of of course for a great plug in and for taking time to look.

1:33 am
17 Sep 2008


releasepirate

Member

posts 11

2

if WP or this plugin dont offer this feature at all then your going to have to add tables to the DB as well so the data is saved.

http://wordpress.org/extend/plugins/register-plus/

Take a look at that plugin as well i “think” custom feilds can be added very easily

1:47 am
17 Sep 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

3

Yes they can with that plugin but it wont work with SPF3.1.4 - it will with V4 when it is released.

That kind of extra profile data actualy goes in the WP usermeta table so yes - it needs to be saved to the database but doesnlt need a whole table.

I guess the first question has to be are yoiu able to write the necessary code? It is fairly straightforward but is going to need some skill and crafting.

9:53 pm
7 Oct 2008


derrickam

Member

posts 10

4

Hi,

Ok, so. . that does go beyond my skill and crafting abilities. Is this something we can ask you to do, and if so can I get a quote for the client?  If you'd like just contact me off the board.  Thanks!

12:20 am
8 Oct 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

5

I doubt it! You were right in the first post that you need to replicate two fields just like that - giving them unique data names.

In the sf-forms.php file - function sf_profile() you will need to call in the two bits of data. Use the 'location' field as your template changing the name 'location' to your chosen field names.

Then in the file sf-database.php in the function sf_save_profile() you just need to add the two new fields to be saved and again - you can use the 'location' field as your template.

It an't really rocket science!

Can you do that?

9:53 pm
8 Oct 2008


derrickam

Member

posts 10

6

Yeah, I'm usually pretty quick on the uptake!  However, I must have missed something. . . Here are the examples of what I did. .

sf-registration - added lines for the form

<p>
                    <label><?php _e('Address:', “sforum”) ?><br />
                    <input type=”textarea” name=”user_address” id=”user_address” class=”sfcontrol” value=”<?php echo wp_specialchars(stripslashes($user_address), 1); ?>” size=”25″ tabindex=”2″ /></label>
                    </p>

Sf-forms.php added lines

        $profile['address']=sf_attribute_escape($current_user->address);

Sf-database.php added lines

        update_usermeta($current_user->ID, 'address', wp_specialchars(sf_filter_nohtml_kses(trim($_POST['address']))));


So the form is still working amazingly but the new data is not going to the database or the administrator email.  So, what did I miss?

Thanks a lot!


10:05 pm
8 Oct 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

7

I misread it and thought you were adding this to the profile page. The profiloe forms and registration frms are two discreet items. The instructions I gacve you were for the profile form only. But the principle is the same.

You can't 'display/collect data' and 'save/update' it in the same place or piece of code. There has to be a display/rendering/data collection routine AND a database update routine.

In the registration code everything between the comments - Regiistration Action - is the save/update routine and everythng below that (down to the Lost Password comment) is the form display.

Worth noting that this file will no longer exist in V4 however.

11:13 pm
8 Oct 2008


derrickam

Member

posts 10

8

Well, I know you're going to do this for V4, but I need to try to handle it until then. (blast!!)

So I understand what I've done is created the fields to collect the data and the displays in their profile to show the data.  What I need to do is collect the data (phone & address) then ship it off in the amin email. Heck, as long as the phone and address went to the Admin, we would'nt really have to collect it.

So in the save/update which I beleive you are saying is between the #Register Action comment & the Registration form comment.  At first glance it looks to me that I have to add addional line for each (phone, Address) to the check admin section. .  Then update this line “$user_id = wp_create_user( $user_login, $user_pass, $user_email );” to reflect the new data as well $user_phone, $user_address.  Is that correct?

Also is there any other updates on the sf-database.php? I can't see it, but I'm pretty fresh to php code so I'm not sure I'd see an elephant if it were staring at me!

Thanks again,

12:23 am
9 Oct 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

9

No no no. This isn't going to work. Yoiu want to add this to thew admins email? Then you are needing to hack WP code as well as forum code. I would advise against this.

1:20 pm
9 Oct 2008


derrickam

Member

posts 10

10

ok,  I was wondering about that actually the more I thought it though.  However, it should be able to just be added to the database correct?

6:17 pm
9 Oct 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

11

yes - that's what the calls to the  USERMETA table do and that is the right place to store them.

6:59 pm
9 Oct 2008


derrickam

Member

posts 10

12

Ok.  Hey, I want to say thanks again for taking time with me on this.  I appreicate it and I'm learning a lot as I go.

So I went ahead and inserted the two new bits on registration action.

$user_id = wp_create_user( $user_login, $user_pass, $user_email, $user_phone, $user_address );
                if ( !$user_id )

Since this is not on my server it's a bit of a hassle each time i need to check the tables. I have to upload files, then have their IT guy send me the results of a test.  Is there any reason that I should have to add the checks for user_phone & address as well?  I am thinking about security issues if someone could just add any sort of code there and cause problems.  Maybe I'm overthinking it but I wanted to check.

8:08 am
10 Oct 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

13

Why are you trying to tack these on the end of wp_create_uer? or does that work?

7:42 am
11 Oct 2008


Thomas

Guest

14

I just have a question, when I try adding more fields, it doesn't work. But when I replace existing fields like “icq” for “age” it does work. Do you have any idea why that is? I've made sure I defined everything correctly, but it always gives me a T_field error when trying to add new fields.

9:06 am
11 Oct 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

15

perhaps I'm being stupid but I don't knw what a T_FIELD error is. perhaps a little more detail might help and the full error message text.

3:38 pm
11 Oct 2008


Mr Papa

Moderator

Arizona, USA

posts 1602

16

t-field error is a php error indicating you have the wrong types (often caused by syntax errors) in a php statement… usually very easy to debug…  yes, full error message and the corresponding line of code that generates the error message…

11:30 pm
11 Oct 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

17

I have never had one then! And I looked it up in the php manual error codes and it didn't get a mention. Most odd.

3:51 am
12 Oct 2008


Thomas

Guest

18

Actually I am getting a new error now.

Parse error: syntax error, unexpected '}' in plugins/simple-forum/forum/sf-database.php on line 1550

BTW, I was just wondering, is it possible to replace author_url with the profile popup throughout Wordpress? So when you click on someone's name it will bring up their profile instead of their website?

6:02 am
12 Oct 2008


Mr Papa

Moderator

Arizona, USA

posts 1602

19

have you modified sf-database.php??  need to see the whole section or function that you have modified…

no, there is not an option to replace the url…  the code change is a bit involved but could pass it along if interested…

7:07 am
12 Oct 2008


Thomas

Guest

20

I have. I just redid it now field by field and it is working for the most part. One field keeps producing the same result from a different field, even though everything is right and I see the usermeta in the databse… guess I'll just have to comb through that slowly again.

I would be interested in knowing the code change for it, please email it to my email saint_cardinal@hotmail.com

11:41 pm
12 Oct 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

21

Actually it's not quite so simple. It's not just a link to the popup. It also needs certain CSS and javascript loaded. if you're up to all of that I can point you in the right direction.

9:17 am
13 Oct 2008


Thomas

Guest

22

I don't mind. I would love to know, Andy. If you or Mr Papa can point me in a general direction I'd really appreciate that.

10:03 am
13 Oct 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

23

OK - well this might get complicated so it would be best to take it one step at a time. Am bound to miss stuff. So

  1. In the file 'sf-startup.php' is the function sf_setup_header() you will find the script that loads HighSlide. It starts where it begins to echo the Script tag and ends with the last echo statement (11 code lines). This script will need to be placed in your theme header file - and remember this is php so will need opening and closing php tags unles you place it inside existing tags.
  2. In the file 'sf-topiccomponents.php' right at the very bottom is a function named sf_render_extended_profile_url().  There are two lines of code there (lines starting $site= and $out=) and you need them both.
  3. They currently display the profile icon/button as you will see but you can change that of course. Note that the user id must be known and used.

I am not saying this will work as I have never tried it. But it's the best I can do to get you started and then we have to look at the result before progressing further.

By the way - some of this may no longer work in V4 although I can't be sure of that without trying it….



Reply to Topic: Registration Addition

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 6 + 10        (Required)

Topic Reply:


 
 

About the Stuff at Yellow Swordfish forum

Currently Online:

5 Guests

Maximum Online: 71

Forums:

Groups: 3

Forums: 16

Topics: 2068

Posts: 14091

Members:

There are 1003 members

There are 837 guests


Yellow Swordfish has made 5252 posts

Top Posters:

Mr Papa - 1602

-Radio- - 558

ovizii - 114

jfv - 82

angelic007 - 72

Administrator: Yellow Swordfish | Moderators: Yellow Swordfish, Mr Papa, -Radio-


© Simple:Press Forum - Version 3.1.4 (Build 357)