Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
biochemist
Jun 2, 2005

Who says we don't have backbone?
OK, so I've got a wonky little problem. I'm building a ratings system, built around the p2 theme (it looks like a facebook status update). See if you can make sense of this-

I added an extra column to the wp_posts table to store my rating because I wasn't sure where else to put it, and I wanted to make sure that a field for the rating was created. I'm playing around trying to be able to sort the posts based on the rating that is stored in the database.

Based off of the codex and a few other google searches, here is what I came up with:

code:
$querystr = "
SELECT *
FROM $wpdb->posts
WHERE post_status = 'publish'
ORDER BY rating DESC
";

 $pageposts = $wpdb->get_results($querystr, OBJECT);?>
        <?php if ($pageposts): ?>
  <?php global $post; ?>
  <?php foreach ($pageposts as $post){
  	the_post(); 
        ratings stuff yadda yadda
        p2_load_entry();
  }
endif; ?>
I wouldn't be here if this worked- it doesn't have any effect on the ordering of the posts. I played around with the query trying to figure out if it was working at all, and it was acting real weird. Let me try to explain:

If I took out the ORDER BY and replaced it with AND rating='100', it would display the first X entries, where X is the number of posts with a rating of 100. Rating!='100' would give the first X entries, X is how many don't have a rating of 100. The behavior is similar if I do ID='1', etc.

What did I (not) do?

Adbot
ADBOT LOVES YOU

Ned
May 23, 2002

by Hand Knit
Don't mess with the DB. Just use a custom meta field for rating.

biochemist
Jun 2, 2005

Who says we don't have backbone?

Ned posted:

Don't mess with the DB. Just use a custom meta field for rating.

How do I call add_post_meta() or any of the other WP calls in a POST statement? I can use get_post_meta() when I'm initially loading the page, but I need to be changing the rating on a javascript button click.

I've tried this on the .php I call with $POST:
code:
wp_head();
add_post_meta($post_ID, '_rating', $averageRating);
wp_footer();
but as I expected, no dice.

Ned
May 23, 2002

by Hand Knit
Go here - http://codex.wordpress.org/Class_Reference/WP_Query

Search for this: Custom Field Parameters

you probably want to do update_post_meta to set it and just make sure you are getting the proper ID when you post.

If you want to do things probably you should probably learn about the wonder that is admin-ajax.php

biochemist
Jun 2, 2005

Who says we don't have backbone?

Ned posted:

Go here - http://codex.wordpress.org/Class_Reference/WP_Query

Search for this: Custom Field Parameters

you probably want to do update_post_meta to set it and just make sure you are getting the proper ID when you post.

If you want to do things probably you should probably learn about the wonder that is admin-ajax.php

I'm not sure if you're pointing me in the right direction, or if there's a miscommunication, but thanks for trying.

I've got a javascript event tied to clicking either a thumbs up or a thumbs down button. On that click, I have a jQuery $.post call that gives my ratings.php a couple of values (post_ID, user_ID, vote). I use those values (after sanitizing) to make a prepared SQL query for a table called ratings.

Further down ratings.php, I want to update the meta data of the post that was just rated. Simply calling update_user_meta(yadda yadda yadda); doesn't do anything, and I was assuming the $.post call is out of the scope of Wordpress so the WP functions can't be called.

What I ended up doing was directly adding to the postmeta table through sanitized and prepared SQL statements. Is this a huge security gap? I know about SQL injections and such, I just don't know if there's a way to be protect against it if I'm writing my own SQL, and I'm not sure how to avoid doing that.

Thanks!

abelwingnut
Dec 23, 2002


Best free plugin for forms?

cocteau
Nov 28, 2005

The best Darcy.

Abel Wingnut posted:

Best free plugin for forms?

I like contact form 7.

Ned
May 23, 2002

by Hand Knit

cocteau posted:

I like contact form 7.

Yay! Support Miyoshi-san!

cocteau
Nov 28, 2005

The best Darcy.

Ned posted:

Yay! Support Miyoshi-san!

Explain?

Ned
May 23, 2002

by Hand Knit

cocteau posted:

Explain?

Miyoshi-san is the creator of Contact form 7. We have a company here together in Japan.

cocteau
Nov 28, 2005

The best Darcy.

Ned posted:

Miyoshi-san is the creator of Contact form 7. We have a company here together in Japan.

Well, that's excellent then.... I've used the plugin a lot. Nice and simple, works every time.

indulgenthipster
Mar 16, 2004
Make that a pour over
I've been hired to add a fancy javascript interactive map to an existing website. It's been straightforward so far until I needed to create some database generated pages using custom post types for an ajax portion of the map, in Headway. Without Headway, I would just create a template file and not include the header and footer of the Wordpress site, then hit the page with ajax to display the content.

But can this even be done in Headway?

I've resorted to writing PHP code in a "leaf" textarea, along with CSS disabling parts of the template. It seems to be the only way.

indulgenthipster fucked around with this message at 20:43 on Feb 1, 2012

Mr Interweb
Aug 25, 2004

Gyshall posted:

Try Disqus.

Tried to tinker around with it. It has some nice features (which I'll need later on), but doesn't seem to have what my original request was.

the kawaiiest
Dec 22, 2010

Uguuuu ~
I'm looking for a free, two-column responsive minimalistic theme, preferably without images. Any ideas?

e: found the perfect theme: http://leonpaternoster.com/wp-themes/

the kawaiiest fucked around with this message at 23:11 on Feb 7, 2012

iLurk
Jul 25, 2007

Who wants to get PREGNANT?!?
Anyone have a good method for migrating a WP site from one server to another?

I tried using WordPress Move, which seemed to do everything I needed. I did a test run, where I had to change the domain name. Everything seems to of gone out, except if I go to any page but the home page I get a 404. This includes new pages I create.

I first thought the issue was some data not switching over in the wp_options table, but after viewing it, it looks like everything is set up correctly. My gut is telling me that this issue wont happen when I do the actual transfer, since the domain name wont be changing.

Ned
May 23, 2002

by Hand Knit
Did you set your permalinks?

iLurk
Jul 25, 2007

Who wants to get PREGNANT?!?

Ned posted:

Did you set your permalinks?

All that digging and I missed that. Thanks a ton!

poxin
Nov 16, 2003

Why yes... I am full of stars!
Does anyone happen to be familiar with the Pods CMS plugin? I'm trying to move my archaric and poorly coded inventory system over to it but I'm having issues on some key things. I have most of it working and can figure out the rest but I'm stuck right now. I'd be willing to throw some cash over for some help too.

Ned
May 23, 2002

by Hand Knit

poxin posted:

Does anyone happen to be familiar with the Pods CMS plugin? I'm trying to move my archaric and poorly coded inventory system over to it but I'm having issues on some key things. I have most of it working and can figure out the rest but I'm stuck right now. I'd be willing to throw some cash over for some help too.

Use custom post types and taxonomies! Much better than Pods at this point in time.

poxin
Nov 16, 2003

Why yes... I am full of stars!
Edit: Never mind

poxin fucked around with this message at 02:01 on Feb 14, 2012

Mons Hubris
Aug 29, 2004

fanci flup :)


Nevermind!

Mons Hubris fucked around with this message at 06:22 on Feb 15, 2012

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION
Speaking of custom post types... I've been working on something that called for a custom post type so I did some research and banged up a quick custom post type that has the provision for recording two custom fields of information against it. These fields are "author" and "author url". For some reason I can enter data in, save it and it sticks - I can see the data from those fields on the site, I can see the data in those fields when I edit the "post". But for some reason after a seemingly arbitrary period of time the fields are being reset to blank for some reason. Why on earth is this happening?

Rime
Nov 2, 2011

by Games Forum
Forgive me for sounding like an idiot here.
It seems that every time I create a wordpress blog, it ends up being hacked and defaced by a bunch of palistinians within about 4 months. Any suggestions for hardening?

cocteau
Nov 28, 2005

The best Darcy.

Rime posted:

Forgive me for sounding like an idiot here.
It seems that every time I create a wordpress blog, it ends up being hacked and defaced by a bunch of palistinians within about 4 months. Any suggestions for hardening?

First questions:

Where are you hosting your sites?

Do you use "admin" as your user name? Do you have a complex password?

Rime
Nov 2, 2011

by Games Forum
The last time it happened I was on a reseller hosting account with HostingZoom that I was running some affiliate test sites on as well. Complex passwords (Upper & Lowercase, symbols, numbers), not using "admin" as the login.

xenilk
Apr 17, 2004

ERRYDAY I BE SPLIT-TONING! Honestly, its the only skill I got other than shooting the back of women and calling it "Editorial".
I'm curious to know how you guys would go about this problem.

I'm building a bilingual site (using qTranslate plugin to manage the French/English content). The problem I'm facing right now is that some pages have two distinct content zones which I'd like to be able to manage as well.

At first I thought secondary-html-content would help me out but I figured I was kind of hosed since I need the secondary html content to be available in both French and English.

I'm thinking of using the div-shortcode plugin and going from there. It seems like it might do the trick for me but might end up confusing for the client. Has anyone faced a situation like this before?

the kawaiiest
Dec 22, 2010

Uguuuu ~

Rime posted:

The last time it happened I was on a reseller hosting account with HostingZoom that I was running some affiliate test sites on as well. Complex passwords (Upper & Lowercase, symbols, numbers), not using "admin" as the login.
Were you keeping WP and all your plugins updated? Also, did you have this plugin or something similar? http://wordpress.org/extend/plugins/limit-login-attempts/

e: or this http://wordpress.org/extend/plugins/user-locker/

the kawaiiest fucked around with this message at 00:03 on Feb 18, 2012

gwar3k1
Jan 10, 2005

Someday soon
I'm looking for a template / plugin that shows a week view timetable. Preferably Time as columns and days as rows, with the ability to set blocks of time (30m intervals between office hours) as being available or unavailable.

This is something I could write, but why reinvent the wheel, right?


What I have in my mind may be too specific, and I may be better to do it by myself. But examples are welcome if people have used such plugins before.

gwar3k1 fucked around with this message at 00:23 on Feb 18, 2012

Rime
Nov 2, 2011

by Games Forum

the kawaiiest posted:

Were you keeping WP and all your plugins updated? Also, did you have this plugin or something similar? http://wordpress.org/extend/plugins/limit-login-attempts/

e: or this http://wordpress.org/extend/plugins/user-locker/

Nope, but I'm installing user locker now, that's fantastic thanks!

the kawaiiest
Dec 22, 2010

Uguuuu ~

Rime posted:

Nope, but I'm installing user locker now, that's fantastic thanks!
Sure thing, hope it helps. :)

Ned
May 23, 2002

by Hand Knit

xenilk posted:

I'm curious to know how you guys would go about this problem.

I'm building a bilingual site (using qTranslate plugin to manage the French/English content). The problem I'm facing right now is that some pages have two distinct content zones which I'd like to be able to manage as well.

At first I thought secondary-html-content would help me out but I figured I was kind of hosed since I need the secondary html content to be available in both French and English.

I'm thinking of using the div-shortcode plugin and going from there. It seems like it might do the trick for me but might end up confusing for the client. Has anyone faced a situation like this before?

Could you use child pages and then have a special template on the parent page in order to pull the child page content?

Broccoli Must Die!
Aug 12, 2004

Meow.

the kawaiiest posted:

I'm looking for a free, two-column responsive minimalistic theme, preferably without images. Any ideas?

e: found the perfect theme: http://leonpaternoster.com/wp-themes/

Ooh, that's quite a nice theme, I may look at using it myself.

When you say "responsive", what exactly do you mean by this?

the kawaiiest
Dec 22, 2010

Uguuuu ~

Broccoli Must Die! posted:

Ooh, that's quite a nice theme, I may look at using it myself.

When you say "responsive", what exactly do you mean by this?
I mean that when you resize the window, or browse the web site on a small screen like an iPhone, the theme doesn't break -- everything shrinks and fits into the screen. Go to the demo for the theme and resize your browser window. :)

Unrelated but I just remembered another security plugin that I use, maybe it'll be helpful to you, Rime: http://wordpress.org/extend/plugins/secure-wordpress/

abelwingnut
Dec 23, 2002


A client came to me asking for help with their site, movietriviaapps.com. They want a static front page and a blog secondary page, movietriviaapps.com/blog. As of now this isn't working properly.

The static page loads fine, but the designated blog page doesn't load posts. Instead movietriviaapps.com/home/blog does load posts.

Why might this be? I've gone in the backend but my PHP knowledge is limited. I've triple-checked the static page/blog page setting under Reading. Also I've changed the template of the blog page, making sure that didn't play a role.

:confused:

fac53
Oct 22, 2002
At last! A dead star!

Abel Wingnut posted:

A client came to me asking for help with their site, movietriviaapps.com. They want a static front page and a blog secondary page, movietriviaapps.com/blog. As of now this isn't working properly.

The static page loads fine, but the designated blog page doesn't load posts. Instead movietriviaapps.com/home/blog does load posts.

Why might this be? I've gone in the backend but my PHP knowledge is limited. I've triple-checked the static page/blog page setting under Reading. Also I've changed the template of the blog page, making sure that didn't play a role.

:confused:

Is the Blog page a child page of the Home page? If so, make it a regular top-level page and the yourdomain.com/blog URL should work.

Flaggy
Jul 6, 2007

Grandpa Cthulu needs his napping chair



Grimey Drawer
What is a ecommerce plugin that everyone recommends? We put our coffeeshop online and want to be able to sell the coffee online. Something easy, looks good, accepts, paypal, credit cards is what we really want.

fac53
Oct 22, 2002
At last! A dead star!

Flaggy posted:

What is a ecommerce plugin that everyone recommends? We put our coffeeshop online and want to be able to sell the coffee online. Something easy, looks good, accepts, paypal, credit cards is what we really want.

I prefer Cart66 because it doesn't try to do too much. It handles the shopping functions and leaves the templating and page structure up to WordPress. I've never needed to use the paid version, so I can't speak to those features.

I built one site with WP e-Commerce and it was a giant pain in the rear end. Lots of bugs, no decent/up-to-date documentation, and you have to reverse engineer their default theme to make your own templates for it.

I've never used WooCommerce, but it looks nice.

Flaggy
Jul 6, 2007

Grandpa Cthulu needs his napping chair



Grimey Drawer
Thanks for the quick reply, I tried playing with WP e-commerce and yes, it was a huge pain in the rear end. I am going to give Cart66 a try and take a look at Woo Commerce.

abelwingnut
Dec 23, 2002


Stuart McSlim posted:

Is the Blog page a child page of the Home page? If so, make it a regular top-level page and the yourdomain.com/blog URL should work.

I changed it to a child of home trying to diagnose the issue but changed it to parentless after that didn't help.

Adbot
ADBOT LOVES YOU

Gyshall
Feb 24, 2009

Had a couple of drinks.
Saw a couple of things.
WooCommerce gets my vote - it is pretty slick and handles most every job I've had to do swimmingly.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply