problem with custom field radio button
-
I’ve created a customfield called account. It has 2 options: standard and premium.
What I’d like to do is simply check if the option on account is standard do something else something else. But it keeps showing premium even if I set the account to stanard! Here’s my code:
`
standardpremium
`
Any help is much appreciated!TIA
-
Where do you get/set the variable $account_type from?
Hi hnla, I set it within the account registration page. So when you register, you select the account type.
Ah I think the penny has just dropped! I need to call it as a standard field value, then compare it. So:
`standard
premium
`
Unless there is an easier way?
TIAEdit// just saw your last post- not sure how that slipped past so you are using xprofile field data and so yes your first example won’t work I think you’re on the right track now and it is easier if in a members loop. There was a post earlier today discussing this. Have a search back about 20 odd posts
Then we would need to know the mechanism you’re using to pass that variable around I guess.
When you say “select account type” what exactly do you mean, is this a snippet of custom code you have written or are you using the custom profile fields to create new profile fields? If new profile fields ( the best way I would have thought ) then you are taking the wrong approach to fetching those fields back.
Hi hnla,
The above seems to work just fine for me. I created the custom profile field account type and then using the above I can do what I need too.
Not sure if it helps anyone but certainly does the job for me!
Thank you, your reply certainly kick started the grey matter!
hi @jarvo1980 ,
could you please tell whether is it possible to use your approach/code to make 3 types of account and each of them would lead to different custom profile fields?
probably, this is exactly what you want to do, maybe you could write full code?thank you!
P.S. there are several topics on this question, but as I see, those who have done it do not want to share their result.
one of them:
https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/can-you-run-multiple-profile-loops-in-singleprofile-loop-php/If someone knows how to, please share. I’m sure, a lot of people would love to use it.
maybe you could write full code?
here are several topics on this question, but as I see, those who have done it do not want to share their result.
@janismo please take care not to come across as treating this support forum as though it was a service with some sort of obligation on the part of the members to write code for peopleIf you look around you will see that many of the experienced BP developers spend a great deal of their time helping out non coders with a great deal of code.
Not including this thread where I didn’t really end up having to help to any real degree I have responded on two other threads today about profile fields, along with other threads I have read or participated in I know that the answers you seek are available. Sometimes you have to piece together bits of the jigsaw to start with, then show us how far you have got and the problems you might be having and we’ll help out further; of course also someone may come along and just write what you want
I only know what I do about the profile fields and manipulating them from needing to do so myself then reading a few posts but other than that I sat down and started coding and worked it out the hard way.
To get you started create three new profile fields for users to complete, probably radio button choices, the users will select one of these at signup? make the selection obligatory.
Now in the members profile loop you will use a simple check to determine which field has been returned or selected by the user and display whatever particular elements you want for that selection.
The code used here is not the type you want, in a profile loop it’s easier as you can run checks using something like:
if(bp_get_member_profile_data( ‘field=account type’ ) == ‘special’) :
‘ Do stuff based on the type above’;hi @hnla ,
thanks for the starting point, will try to search forum again to find idea for further part of the code.
re your position of members obligation, have to say that your point of view re my respond is completely wrong as I respect what you guys are doing, in some cases it is even non-understandable why you are doing this…e.g. @pcwriter tried to help me in one question, writing x lines of code.
completely another point are people, who get help from members side, but later do not even respond on requests for help in the same question, what is selfishness.
returning to the code for account types, I’ve been trying to find solution in internet (bp forum too) for days, have seen several unresolved/ununswered topics, therefor I’m a bit surprised re your words that question was solved. If you mean that this code can be written taking X parts of code from X topics, have to conclude that my knowledge of php will not allow me to do this in the near future and for help to people like me, it would be great to write solution in one place, as I’m sure this question is interesting for a lot of people. If I will find this code, it definitely will be reposted here.thanks again!
Yes but the point is that one can’t simply state that they haven’t got sufficient knowledge and use that as a reason that those that do should therefore write the code for them; think about it. We all had to start somewhere and gain that knowledge it wasn’t handed to us.
If some posts don’t appear to give a complete and rounded solution it’s often that you need to follow the thread through and piece together the info contained in it. If there hasn’t been a response back sometimes that means that one wasn’t warranted as the answer was already provided, sometimes we are just all plum too tired?
On a voluntary help forum it sadly is never appropriate to expect anything at all of those that give of their experience for free.
Don’t take this the wrong way i’m just trying to lend a little perspective and to prevent you perhaps saying things that may be interpreted the wrong way
you did not understand the idea of what I wrote
very probably not, so ignore my comments and start to pull that code together and throw it up to the forum if/when you get stuck and we’ll help get it as it’s needed P.S probably best to start a new post though?
- The topic ‘problem with custom field radio button’ is closed to new replies.