Compatability with Magic Fields 2

Hey Guy’s

I was wondering if any of you knew if membership is compatible with Magic Fields 2 []?

I currently am using “members” [] as my membership and role manager.

When using them together I’m getting one hell of a confusing error:

Warning: Attempt to assign property of non-object in /home/spsp/public_html/wp-content/plugins/members/includes/functions.php on line 22

that shows up any time I call

Code from Magic Fields 2

$members = get_group('exercise_instructions');

Here’s the code for context:

Code from Magic Fields 2

// second way to get the fields

// get_group will return an array of all the groups and the group's fields
// the parameter for this function is the group's name
$members = get_group('exercise_instructions');
// to see how the array is formed you can use pr($members);
// the way the array is formed is
// [group index][field name][field index]
// The image fields in the array have one more level where the letter "original" and "thumb" which will show
// the original or the thumbnail image
foreach($members as $member){
echo $member['exercise_instructions_single_instruction'][1]."<br />";
echo $member['exercise_instructions'][1]."<br />";
echo $member['exercise_instructions_exercise_reps'][1]."<br />";
echo $member['exercise_instructions_exercise_instruction'][1]."<br />";
echo "<img src='".$member['exercise_instructions_demo_image'][1]['thumb']."'><br /><br />";
<?php the_content( __( 'Continue reading ?', 'twentyten' ) ); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong>

Now the strange part is that if i move the_content up it displays without error. It’s only after the

get_group(‘exercise_instructions’:wink: that there is an issue.

the get_group function looks like this.

Code from Magic Fields 2

function get_group( $group_name , $post_id = NULL ){
global $post,$wpdb;

if(!$post_id){ $post_id = $post->ID; }

$sql = sprintf(
"SELECT m.field_name, c.type, w.meta_value, m.group_count, m.field_count, c.options ".
"FROM %s m " .
"JOIN %s c ON m.field_name = " .
"JOIN %s g ON c.custom_group_id = " .
"JOIN %s w ON w.meta_id = m.meta_id " .
"WHERE m.post_id = %d AND = '%s' AND w.meta_value <> '' ".
"ORDER BY m.group_count,c.display_order, m.field_count ASC",

$fields = $wpdb->get_results($sql,ARRAY_A);

$result = array();
foreach($fields as $field){
$type = $field['type'];
$options = $field['options'];
$value = $field['meta_value'];
$group_index = $field['group_count'];
$field_index = $field['field_count'];
$field_name = $field['field_name'];

$value= unserialize( $value );

$result[$group_index][$field_name][$field_index] = _processed_value($value, $type, $options,1);
return $result;

The error…

Warning: Attempt to assign property of non-object in /home/spsp/public_html/wp-content/plugins/members/includes/functions.php on line 22

is coming from:

$members->settings = get_option( 'members_settings' );


Code from Members Plugin

* Gets a setting from from the plugin settings in the database.
* @since 0.2.0
function members_get_setting( $option = '' ) {
global $members;

if ( !$option )
return false;

if ( !isset( $members->settings ) )

$members->settings = get_option( 'members_settings' );

if ( !is_array( $members->settings ) || empty( $members->settings[$option] ) )
return false;

return $members->settings[$option];

Now I’m contemplating switching to the membership plugin based on this error. if i can’t figure out a fix for this issue.

My question is will I have a similar issue with Magic Fields & your plugin that takes care of role management and members content?

  • DavidM
    • DEV MAN’s Mascot

    Hi squiwrl and first off, welcome to WPMU DEV!

    I haven’t actually tried Magic Fields 2 myself, but it seems a little bit like CustomPress in functionality, which works just fine with Membership. Given the type of capabilities being provided by such plugins I can’t really imagine Membership not working with them, so I wouldn’t think there would be any issues using Magic Fields 2 with it.

    To be clear though, Membership doesn’t provide role and capability customization itself, but should work just fine alongside plugins that do, such as the User Role Editor.

    Perhaps you could give the User Role Editor a try with Magic Fields 2 first? It seems similar to the Members plugin.



  • squiwrl
    • WPMU DEV Initiate

    I have quite a bit of time invested in the previous two plugins already though that’s what my biggest concern is. Do you know of a way to to sort out the issue with the tow plugins as is? The project I’m doing is on a tighter deadline than I’d like it to be…. as always of course. If I can figure it out I’m in the clear.

  • Mason
    • DEV MAN’s Sidekick


    Just to be clear, the issue is with the members plugin, correct? Not our membership plugin?

    The members plugin has it’s own support forum – both on and on the developer’s own site (ThemeHybrid if I remember correctly). We really have to refer you to one of those sources for plugins that aren’t run by us here.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.