Magic Tag not Working for Pick Column

0

I have a Pod called 'classified_ads', one of the columns is a pick to WP User called 'wp_user'.

In my template, I cannot for the life of me get the user ID outputted with magic tags. The template is being called by shortcodes in a WP Page.

For example {wp_user.ID} yields nothing. All the other columns magic tags function as expected.

However if I use PHP like so, it does get output:

<pre> $ads = new Pod('classified_ads'); $ads->findRecords(); while($ads->fetchRecord()): echo $ads->get_field('wp_user.ID'); endwhile; </pre>

That will give me the correct IDs, but why wouldn't the magic tags work the same?

My DB prefix is not the default 'wp_' if that has anything to do with it.

Thanks for any ideas on this.

asked Feb 8 '10 at 5:55

jackson

33

add comment
enter at least 15 characters

5 Answers

0

EDIT -

I am using the magic tag as {wp_user.ID} NOT without the '@' symbol as indicated above.

answered Feb 6 '10 at 4:06

jackson

33

add comment
enter at least 15 characters
0

Double check your template. Are you sure that the tag is showing up with the @? When saving stuff to the database (such as templates or pages), Pods automatically replaces any instance of '&#64;wp_' with the database prefix - this is a side effect of the pod_query() function.

answered Feb 7 '10 at 12:26

tokyograph

41

add comment
enter at least 15 characters
0

tokyograph is actually correct, however, I've got a patch that will be going into 1.8.2 which will solve this issue going forward.

Pods currently automatically replaces all instances of "wp_" with your table prefix. As a side effect, this replaces any instances of "wp_" in your code as well.

My fix just finds all "{wp_" and replaces it with a Pods internal variable which will get replaced after the initial "wp_" replacement is done, which then is switched back to "{wp_" so your code remains untouched.

answered Feb 7 '10 at 12:41

sc0ttkclark

2936

add comment
enter at least 15 characters
0

As proof of the issue, you can see how in this thread, it's gone and done it too ;)

Our new forums will have a fix which will secure them further from this type of stuff too, so even if they enter @ wp_ (without the space) it won't show the template. We'll release the Pre Save Helper that makes that possible separately.

answered Feb 7 '10 at 12:50

sc0ttkclark

2936

add comment
enter at least 15 characters
0

So, to resolve this I renamed my pick column from 'wp_user' to 'wordpress_user' and now it works as expected.

I couldn't find any way of making it work without changing the column name.

Thanks Scott and tokyograph!

answered Feb 8 '10 at 5:55

jackson

33

add comment
enter at least 15 characters