latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

A little REGEX help please!

Home Forums Community Forum A little REGEX help please!

This topic contains 2 replies, has 2 voices. Last updated by  Manuel Gentinetta 3 years, 2 months ago.

Topic Author Topic
Posted: Tuesday Oct 8th, 2013 at 12:30 pm #60227
Epix Media
Username: epixmedia

Hi all, I’ve successfully implimented loooaddss of custom member list with searches, however I now have a client that wants to use the mutli select box feature. My current code falls down here as the REGEX I use to select the category from the meta_value field only works with the single select box.

Here is the data as it appears in the database:

s:8:"category";a:1:{i:0;s:17:"Business services";}}

Here is my current AND line in my SQL statement

AND UMS.meta_value REGEXP '.*"".$_SESSION['searchfield']."";s:[0-9]+:".*".$_SESSION['searchvar'].".*".*'

How can I modify the above to work with the new multi option data?? I’ve tried a few things but REGEX is hardly a strong point of mine.

Cheers!!!

Zoe

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Monday Oct 14th, 2013 at 3:47 am #60335
Epix Media
Username: epixmedia

Is anyone able to help with this at all? Am rather stuck and my client needs this feature…

Cheers!

Zoe

Posted: Wednesday Oct 16th, 2013 at 11:54 am #60407

As a regex, something like this might work:

AND UMS.meta_value REGEXP '[^"]+\"" . mysql_real_escape_string( $_SESSION['searchfield'] ) . "\".+\"" . mysql_real_escape_string( $_SESSION['searchvar'] ) . "\"'

A quick hack might be

AND UMS.meta_value LIKE '%" . $_SESSION['searchfield'] . "%' AND UMS.meta_value LIKE '%" . $_SESSION['searchvar'] . "%'
Viewing 2 replies - 1 through 2 (of 2 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.