Skip to content

Archive for October, 2009

25
Oct

>Chilling cat

>


12
Oct

Trouble with the Site Members Loop?

I have been having some trouble with the site members loop. Originally i had the template as normal, i simply changed the “type” variable to active for the widget loop. But what was heppening was the widget was being paginated aswell and only displaying the users that were on the Member-Directory column. ( Basically the widget was using the directories loop for information.)

The easiest way to overcome this error is to copy the widget code and place it in a file of its own, then simply call the file. I did that and got my loops to work independently.

Another thing to help would be to set the members directory loop to call all “alphabetical” users and not just the “active”, whats the point of having two loops calling recently active users.

Members Directory Files

members-loop.php

index.php

active-members.php

10
Oct

>Sunset

>


7
Oct

Conversion Thank You page for BuddyPress Registration

I recently had to create a second step “Thank you” page for a client so they could add their Conversion Tracking code to it. Most people will simply add the tracking code to the registration page and set the URLs in your Conversion Tracking software.

Some tracking software programs have trouble when it comes to using the same url for the start and the conversion goal.  Here’s what i did to create a “Thank You” page.

  • Open up your theme folder and copy the register.php template
  • Rename it to thank-you.php (or anything you want really)
  • Next open up thank-you.php and paste the following into it right at the top (line 1) to create a static page template.
<?php /* Template Name: Thank You Template*/ ?>
  • Log into your backend and create a static page called “Thank-you” and select the “Thank Your Template” from the list.
  • Next open up the register.php and insert the following line straight after the call for the register form. This uses javascript to change the action of the form to send to the thank-you page.
<script type="text/javascript"> var changer = document.getElementById('setupform'); changer.action = 'http://yoursite.org.za/thank-you';</script>
  • Lastly to make sure no one visits this page except during the registration process add the following lines of code just below the <body> tag

I have attached the two file register.php and thank-you.php so you can see how i did it.

5
Oct

Running quick tags outside of the loop

For anyone who has had the same frustration I have where you need tocall a function from a plugin, but they only have a quick tag you insert into the post/page.

Solution

<?php echo apply_filters(“the_content”,”[Insert Your Quick Tag Here]“); ?>

This will apply the filter that is usually applied when a post is queried, and display the quick tag as it would normall if you inserted via the backend.

3
Oct

>Eyes wide shut

>


2
Oct

>A poker night

>

I sucked donkey balls
2
Oct

>Silly kitty

>


2
Oct

>Angel of death lost its wings

>


2
Oct

Form Security

I recently learnt that there are two methods of bots messing around with forms on your website.

The following test is quoted from HTML Form Guide

a) As a relay for sending bulk unsolicited emails
If you are not validating your form fields (on the serve side) before sending the emails, then hackers can alter your email headers to send the bulk unsolicited emails. (also known as email injection) For example, hackers can place the following code in one of your form fields and make your form processor script send an email to an unintended recipient:

sender@theirdomain.com%0ABcc:NewRecipient@anotherdomain.com

The code above is adding another email address to the CC list of the email. Spammers can send thousands of emails using this exploit. Your host will not be happy with this and may warn you or even ban your web site.

The best way to prevent this spammer exploit is to validate the fields used in the mail() function(fields like email, subject of the email, name etc). Check for the presence of any “new line” (rn) in those fields. The email form article contains sample code that does the same.
b) For Sending spam messages to you

There are programs known as ‘spam-bots’ that leech through the web pages looking for web forms. When found, those ‘bots’ just fills the fields with a spam message and submits. Eventually you will start getting many hundred submissions send by those spam bots and you will find it difficult to separate genuine submissions from spam messages.

The solution for this problem is to use a mechanism to identify human submitters from ‘bots’. CAPTCHA is one of such tests.

I have included two links in my Resources category to help against these two types of attack