Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter vsantoso

    (@vsantoso)

    I managed to resolve this ??

    I added (array) casting before $tag_array, because probably the $tag_array was empty, and hence PHP throws out the warning message.

    The plugin managed to accomplish what it says, and everything seems working well so far. Hence i close this issue.

    Plugin Author antonchanning

    (@antonchanning)

    Thanks. I’ll have a look at working your fix for this bug into the next release.

    Plugin Author antonchanning

    (@antonchanning)

    I think you may have fixed the bug reported by a couple of other users.

    This will actually save me some work so thanks again!

    I’ll have a look at why $tag_array was empty but not an array in the first place as it sounds more like curing a symptom to just cast it…

    antonchanning,

    When will you be releasing the update to fix errors for bbpress2-shortcode-whitelist.1.3?

    I also get the error message: Warning: Invalid argument supplied for foreach() in plugins/bbpress2-shortcode-whitelist/class_bbpress-shortcode-whitelist.php on line 51

    If the update takes too long to be completed, can you at least explain step by step how to fix the bug that vsantoso corrected to get it working?

    I am having the same issue. I have found the file and line to edit however I am not sure exactly what or how to edit the “(array) casting before $tag_array”. If someone could please post a step by step on how to edit the bbpress2-shortcode-whitelist/class_bbpress-shortcode-whitelist.php file or release update for the plugin.

    Thank you,

    C.S.

    Thread Starter vsantoso

    (@vsantoso)

    Hi csm2012,
    You just need to add this text: “(array)” before $tag_array on line 51.

    It’s called casting $tag_array into array type.

    As mentioned by antonchanning, it’s best if we could find out the root cause. Casting to array is a quick fix to solve the symptom only. But it’s needed to get it working immediately for me.

    Regards,

    Hello Vsantos,

    Thank you for responding so quickly. Getting this plugin to work on my site fast is important to me too. I have gone in to the class_bbpress-shortcode-whitelist.php file and made the edit. I placed the(array) before $tag_array on line 51 and it returns a bigger error on the WP.

    Parse error: syntax error, unexpected T_ARRAY_CAST, expecting ‘(‘ in /home/csmontg1/public_html/diyitdept.com/wp-content/plugins/bbpress2-shortcode-whitelist/class_bbpress-shortcode-whitelist.php on line 51

    Here is my code below.

    function get_known_plugins($tag_array) {
    			$plugins = array();
    			foreach (array)($tag_array as $tag) {
    				$plugin = $this->get_known_plugin_by_tag($tag);
    				if(false !== $plugin) $plugins[] = $plugin;

    Thank you for your help or any other things you think I should try.

    Genuinely,

    C.S.

    Thread Starter vsantoso

    (@vsantoso)

    Hi csm2102,

    Sorry if i didn’t make it clearer.
    You should put the “(array)” exactly before the $tag_array.
    Hence on line 51 it would look something like this:
    foreach ((array)$tag_array as $tag) {

    Vsanto,

    That did it, Thank you again for your quick responses. I am still learning so thanks for your patience. Maybe this will take care of the error message until antonchanning is able to find out what is causing the issue and release an update.

    Thank you again,

    C.S.

    Thread Starter vsantoso

    (@vsantoso)

    You’re welcome ??

    Plugin Author antonchanning

    (@antonchanning)

    Apologies to everyone for my absence and neglect of this plugin whilst I moved house and settled into my new home/city/country. I’ll be releasing this fix very soon…

    Plugin Author antonchanning

    (@antonchanning)

    @vsantoso Your fix is in the latest version of the plugin now. Thanks for spotting that one.

    Thread Starter vsantoso

    (@vsantoso)

    You’re welcome @antonchanning

    Your plugin is very helpful. Thanks for that ??

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: bbPress2 shortcode whitelist] Warning: Invalid argument supplied for foreach() … on line’ is closed to new replies.