Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to make LinkOwner not required?

Quote Reply
How to make LinkOwner not required?
I have upgraded to Links SQL 2.03 and I am havign a problem. I don't want to make it necessary for people to enter a Contact E-Mail or Contact Name. However, whenver I go into the admin to make LinkOwner accept NULL, it reverts back to NOT NULL. Problem is, my database will now not accept links unless a Contact E-Mail is specified. How do I fix this?

Thanks.

Quote Reply
Re: How to make LinkOwner not required? In reply to
This is the solution I found:

Edit Tools.pm at sub validate_links, and look for:

Code:
$link->{'CatLinks.CategoryID'} = \@cat_ids;
.... add this immediately below ....

Code:
$link->{'LinkOwner'} = 'admin';
.... this pushes 'admin' into the LinkOwner field and allows for validation (provided, of course, that you have a user 'admin').

You could also use 'default' or some similar name to differentiate between the links that come from your form, and the links you add yourself.

Hope this helps Smile

All the best
Shaun

Quote Reply
Re: How to make LinkOwner not required? In reply to
Here's my solution, I added the following to my add.html and add_error template:


<%ifnot Username%>
<input TYPE="hidden" name="Contact_Name" value="admin"><input TYPE="hidden" name="Contact_Email" value="links@yoursite.com">
<%else%>
<input TYPE="hidden" name="Contact_Name" value="<%Name%>"><input TYPE="hidden" name="Contact_Email" value="<%Email%>"><%endif%>

That way if a person is logged in, they automatically become the linkowner, otherwise it reverts to the admin. I completely took off the contact and email field as it was just confusing to me and the people adding links.

I know zip about perl so if I can do things in the templates, that's always my first choice.

Bryan

Quote Reply
Re: How to make LinkOwner not required? In reply to
Hi,

I think Bryan's answer is best, since it is sort of how links handles the contact_* fields internally.

You really don't want to start hacking code, especially in a new release, because the code is updated regularly, and you need to keep making the changes. If your site depends on it, it means slower deployment and/or buggy deployment.

So, just assign the unused fields via the templates. Links makes good use of the LinkOwner field, and at some point you might want to start using it.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: How to make LinkOwner not required? In reply to
Sorry, I suppose I'm still stuck in v1.13 mode - where virtually everything I wanted to do ended up being a hack or tweak of sorts Smile

PS. I really like the 'globals', especially now I know about the $tags->(tag_name) thingy ...

All the best
Shaun

Quote Reply
Re: How to make LinkOwner not required? In reply to
Alex improved the speed of the parser, which means we can now ask it to do more, and slow it down further ;) <G>

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