Getting incoming posts by user

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
Author Posts
February 28, 2014 at 4:35 am #3438
dovetail
Post count: 18

Created a custom role called “volunteer.”
Created a custom post type “timecard” with a custom “Related User” field called “volunteer”. Added some timecards in the WP back end, and associated them to a volunteer user. They’re showing up fine in the back end.

Logged in as that user, and browsed to front-end page with this code:

(1) $this_user_id = get_current_user_id();
(2) $this_user = $wf->user_by_id($this_user_id);
(3) foreach ($this_user->incoming(“post_type=timecard”) as $timecard) { … }

Line (3) causes the following PHP errors:

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1178

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1179

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1182

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1178

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1182

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1178

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1182

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1178

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1182

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1178

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1182

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1178

Notice: Undefined variable: iid in /var/www/vhosts/oldstlouis.com/cmavolunteers.com/wp-content/plugins/masterpress/core/api/meow/meow-data-provider.php on line 1182

I var_dumped “$this_user” and it was correct, so it’s definitely the iterator that is breaking the code.

A clue: there were 6 timecards in the system, although only two of them were associated to this user. There were 13 errors, but 6 each attributed to lines 1178 & 1182. I added a 7th timecard, and now there are 15 errors (7 each attributed to lines 1178 & 1182) So it seems like it’s pulling ALL timecards (not just ones associated to this user), and triggering two errors for each, plus an extra error on line 1179.

  • This topic was modified 10 years, 4 months ago by dovetail.
February 28, 2014 at 4:14 pm #3440
traversal
Post count: 207

Hmm, not ideal, clearly. I’ll setup the same scenario myself and work out what’s going on there.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Latest From the Blog

MasterPress 1.4.1 is now available

27th May 2024

This update addresses backwards compatibility issues that were introduced in the previous update. There were some edge cases where PHP 7 had issues and it didn’t work at all on PHP 5.6. We have now changed it so that the PHP 8 compatibility changes will now only affect PHP 8 and will be more thorough… 

Plugin Requirements

MasterPress requires a minimum of WordPress version 4.9, MySQL 5.6, and PHP version 5.6.20.

We also recommend that PHP is configured to use a memory limit of 64MB per request (128MB may be required for sites with higher complexity).

This plug-in is not compatible with the WordPress.com hosted service.

Three AM