Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
801 views
in Q2A Core by
I have a filter set up to prevent certain spammy profiles. I just noticed that when I register, the filter_profile is called, even though there is no profile yet.

It was causing some "Undefined index" PHP Notices in my code because I'm trying to access fields of the $profile variable, but $profile comes to the function completely empty (not even the profile fields set as blank).

Is that intended behaviour? I can obviously work around that by checking the $profile variable, but it seems strange to call it with no profile.
Q2A version: 1.6

1 Answer

0 votes
by
Yes, it's intended, because it's now possible to have profile fields on the registration page. But I guess the function could be skipped if there are no such fields.
by
OK that makes sense. I'd say the main problem was $profile being sent to the function as an empty array(). Shouldn't it at least have the array keys set, i.e. array( 1=>'', 2=>'' )  ?
by
It only contains the profile fields that were entered by the user, so if no fields were entered, what would the keys be for?
...