Anyone hacked com_recommend?

18 years 3 months ago #988 by djsdjs
Anyone hacked com_recommend? was created by djsdjs
Has anyone hacked com_recommend so that it takes sending name and email from the currently logged in user?

It's an extremely simple component, but I don't know what to include in the PHP code to make the user profile data available to the script.

Please Log in to join the conversation.

18 years 3 months ago #1152 by JSalvador
Replied by JSalvador on topic Re:Anyone hacked com_recommend?
There's a simple change that can be made in order the have the recommendation come from the person filling out the form... that is to say, from the email address that they fill out as "Your Email" Otherwise it defaults to "(unknown sender)" Here's an example:

www.likeadove.com/index.php?option=com_recommend

Is this what you're looking for?

Please Log in to join the conversation.

18 years 3 months ago #1310 by dsendecki
Replied by dsendecki on topic Re:Anyone hacked com_recommend?
Anybody come up with anything here? I'd love to get this done!

Please Log in to join the conversation.

18 years 3 months ago #1471 by djsdjs
Replied by djsdjs on topic Re:Anyone hacked com_recommend?
No, I am looking for the fields "Your Name" and "Your Email" to no longer display on the form (hidden would be fine) AND be prepopulated by the logged in user's name and email. It would be great if the code was written to still display the fields when the individual is not logged in.
D.

JSalvador wrote:

There's a simple change that can be made in order the have the recommendation come from the person filling out the form... that is to say, from the email address that they fill out as "Your Email" Otherwise it defaults to "(unknown sender)" Here's an example:

www.likeadove.com/index.php?option=com_recommend

Is this what you're looking for?

Please Log in to join the conversation.

18 years 3 months ago #1478 by dsendecki

Please Log in to join the conversation.

18 years 3 months ago #1699 by dsendecki
Replied by dsendecki on topic Re:Anyone hacked com_recommend?
Already having a recommend which automatically pulled the email address and username from the database for logged in users would be cool!

I tried to figure it out to no avail! Disclaimer: I have never done anything like this before. Literally my first time ever with PHP, but I figured out some things from the file...

Okay, we can hide those fields, we have to declare the values for those hidden fields in the form as:

1) for the "recommend from name"

<input name="recommend_from_name" type="hidden" value="<?php echo $my->name; ?>" />

2) for the "recommend from email"

<input name="recommend_from_email" type="hidden" value="<?php echo $my->email; ?>" />

Okay to get the values to "echo" we need to declare a global for $my, like in the cz_submit component (which I'm using as an example)...

So in the recommendvalidate function we have to do something like this:

function recommendvalidate(){

global $my;

if ($my->name) {
$recommend_from_name = $my->name;
} else {
$recommend_from_name = "";
}

if ($my->email) {
$recommend_from_email = $my->email;
} else {
$recommend_from_email = "";
}

Is that right?

However -- when I try this out, the form doesn't work...

I am only learning right now and have no experience! Could someone -- who has a little time, please help us out in this thread?

I'll buy ya a beer!

:woohoo: :blink: :woohoo: :blink: :woohoo: :blink: :woohoo: :blink: :woohoo: :( :ohmy: :angry: :P :dry: :blush:

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.765 seconds

Facebook Twitter LinkedIn