Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-10-12 03:48:55

cgriff44
New Member
From: Portland, Oregon
Registered: 2005-11-05
Posts: 6
Website

Pull Email Address from a Custom Field

I’m using Textpattern as more of a CMS on a project and I’m trying to find a solution for a simple email problem.

This website is for a mortgage company, and they want all of their loan officers to have their individual page with some way to contact them by their personal email.

So all the solutions I’ve found out there (the txp:email tag, and the zem_contact plug-in) requires me to enter in the email in the tag. The problem with that is that doesn’t allow the flexibility of putting the tag or zem_contact in the template (because I can only enter in one email, and I can’t throw in an article_custom_field tag inside of another tag of course).

So I’m wondering if there is a plugin or something out there that can pull the email via custom field and display a spam proof email or a contact form.

Thanks,

Chris

EDIT:

Nevermind I think I found the solution, I’d delete this thread but I don’t a see a way

Last edited by cgriff44 (2006-10-12 03:56:49)

Offline

#2 2006-10-12 09:40:35

skoggy
Member
From: Westcoast of Sweden
Registered: 2005-03-27
Posts: 209
Website

Re: Pull Email Address from a Custom Field

Why don´t you post your solution for users that might struggle with this in the future?

Offline

#3 2008-03-31 18:20:15

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: Pull Email Address from a Custom Field

Well, indeed that would have been helpful.

I want users to be able to only type the first part of an email address into a custom field, omitting the “@domain.com” part. The output sould be the full address as an active mailto link, but still spamproof.

Is that possible?

Last edited by masa (2008-03-31 18:21:57)

Offline

#4 2008-03-31 19:10:40

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Pull Email Address from a Custom Field

In your article form:

<txp:php>
	$user = custom_field(array(
		// cf name = 'email_address'
		'name' => 'email_address',
	));
	$email = $user .'@example.com';

	echo email(array(
		'email'    => $email,
		'linktext' => $user,
		'title'    => 'Email '.$user,
	));
</txp:php>

Are you just accessing the author’s email (the one they used w/TXP)?

Offline

#5 2008-03-31 19:39:08

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: Pull Email Address from a Custom Field

jm wrote:

Are you just accessing the author’s email (the one they used w/TXP)?

No, it’s for a staff member listing. I’ve set aside custom fields for title, phone no. and email. I thought it would be most user-friendly if they could just type the name and the article form handled the rest including the spam-proofing.

Thanks vey much for the code!

I often wish I’d knew a bit of PHP.

Cheers Martin

Offline

Board footer

Powered by FluxBB