Gossamer Forum
Home : Products : Gossamer Links : Discussions :

add link = add user ... how?

Quote Reply
add link = add user ... how?
Hi,

I just purchased LinksSQL (Version: 2.0.3) within the last few days. I'm very pleased so far. Seems like a very professionally put together piece of work.

Of course, there are a few things I need to do to get it to do what I want. I knew this when I bought it and was eager to tackle the project. However, in looking at how it's put together, I'm now thinking it's just a bit over my head. I'm hoping to get a little guidance/input to get me on the right track.

My first challenge is this:

For marketing/business model reasons, I want every link submission to ALSO be a user, and vice versa. In other words, there is one form, the add link form, which creates the record in the Links table and also creates the record in the Users table (users can only have one link... if they want more, they have to create a new account).

The way I see it, I can either add all the pertinent fields (name, email, username, password, etc) to the Links table (and add resource form), and just ignore the Users table altogether. If I want to use the mailing functions, then the script(s) that handle that would have to be hacked to access the Links table instead of the Users table.

-or-

I can have the script that adds to the Links table also enter the extra information that I gather on the add resource form to the Users table.

So, which way would be more efficient/better? If the former, how would I go about modifying the mail scripts to access a different table? And, if the latter, how would I go about implementing it?

A quick note on my experience level: I've been hacking Perl off & on for a couple years now, but I have next to zero OO and MySQL experience. Plus, I'm finding the "hook" & plugin concept a little daunting. Of course, I'm always willing to learn :-)

Any guidance would be *most* appreciated!



Thanks,
Matt Glaspie
Quote Reply
Re: add link = add user ... how? In reply to
Well, if you are not using the authentication plug-ins like w3t, then you can muck with the links internals a bit more.

I would actually probably do it the simplest way I could, that would survive updates and upgrades with the minimal amount of effort.

That means, put the changes in the add/modify.cgi script, and leave everything else alone.

When the user submits a "new" link, if you have authentication on, you can do one of several things. Modify add.cgi so that if the user exists, they _cannot_ add a new link, they are forced to the modify form, showing their ONE link, where they are advised to create a new user ID if they want to add a new link. If they are not logged in, they are taken to the "log in" form, to either log in, or create a new user ID, so all that stuff doesn't have to be touched. (maybe just put a note that each link must have a separate User ID).

Personally, this is how I would do it. It means only changing add.cgi, using everything else in Links the way it is, and with luck, you'd only have to cut/paste a few lines of code between versions of add.cgi (maybe even be able to use the old version of add.cgi for the most part!).

Make sense for what you want to do?



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: add link = add user ... how? In reply to
Pugdog, sorry I'm having a hard time wrapping my brain around this right now... end of a long week, I suspect.

If I've got this wrong, let me know, but this would involve the "user"/"link adder" having to fill out two forms to enter a link, correct? One to become a User, and the other to add the link?

If this is so, then it probably isn't going to work for me, at least not ideally. My site is really going to cater to webmasters who want to add links. By requiring two "hoops" to jump through, signups will decrease drastically. I'd *much* rather have more admin work to set up and for upgrades than risk a severe drop in signups. My member base will be the biggest part of my business model.

Additionally, another modification I need to do involves additional fields either within the Links table or within another table which must be created, and so I was interested in hearing at least thoughts about table efficiency...

This is just off the top of my head, but what about this: One form - contains all fields for adding a link & creating a user. On submit, add.cgi is run, but with a plugin that "hooks" after add.cgi is processed, and which simply runs the "create user" script.

Would something like that work? Something similar?

Thanks,
Matt Glaspie
Quote Reply
Re: add link = add user ... how? In reply to
With a lot of tweaking you could have one web form to "register" users and also have them "add links". Basically, it would be a matter of calling different DBI objects for each add process...I have this working in Links SQL v.1.X...however, I agree with pugdog that in terms of preserving the scripts for future upgrades and also to keep your scripts organized...it would be best to separate the process...and registering before interacting is common all over the Web, so your audience should not be bothered with having to fill out two web forms....

Regards,

Eliot Lee
Quote Reply
Re: add link = add user ... how? In reply to
If that's how you want to go, just add the fields you want to the Links table, and to the form.txt file.

Then, turn off user_registration.

You won't have any of the $USER variables available, obviously, but you'll have all the fields in the LInks table available. You'd probably want to add Cont_Name and Cont_Email to take the place of the Username/Email.

If you use Contact_Name and Contact_Email, you might find some "odd" behaviour, so don't use them.





PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum