admin (no pm's please)
|
phpBB3: New userinfo/welcome portalMuch like the phpbb2 USERINFO portal, this portal gives access to AVATAR/RANK/IP and some other profile details. It also links the user to the country code database identifying where they are form via a profile field you can set up.
-----------
(phpbb3 only)
To add the country flag profile, create a Single Text Field profile field called "Country", leave everything default.
Open viewtopic_body.html, and add this where you want the flag to show (see http://howtodoit.myfabforum.org for more defails):
| Code: | <!-- BEGIN custom_fields -->
<!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Country" -->
<img src="./ranks/ccflags_medium/{postrow.custom_fields.PROFILE_FIELD_VALUE}.png" /><br />
<!-- ENDIF -->
<!-- END custom_fields --> |
This will show now show the flag on the side when viewing a topic.
|
Zudane
|
How can we set up the profile field?
We can't just do the xprofile field like phpbb2... so how would we do it?
|
admin (no pm's please)
|
Just set up a new phpbb3 profile field.
|
Zudane
|
Does it matter which kind? Since phpbb3 requires you to select boolean, single text, text field, numbers, dropdown box, and date.
I've tried it with the single text and text field, but nothing came up.
|
admin (no pm's please)
|
text is good, but there is good reason nothing happened I expect.
to save load your flag is a cookie, only when the cookie is not there (or showing an invalid value in which case a retry occurs randomly) does the flag get found again, and only then does the profile field get set.
|
Zudane
|
Well, after some playing I got it up, for some reason the profile field didn't want to show up... removed and readded with copy/paste a few times and it worked... oddly.
Anyway, the cookie is set and read properly.. but there's one problem: The info it puts into the profile field is just the code. Mine now shows US, nothing more.
perhaps it needs something to change that code into the flag? Maybe editing the code something like:
Note: Random rough draft just for an idea...
| Code: | <!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Country" -->
<img src="./flag_code/{postrow.custom_fields.PROFILE_FIELD_VALUE}.png"><br />
<!-- ENDIF --> |
Would that be the easiest way to do it, since then it would just replace it to use the country code in the image tag?
|
admin (no pm's please)
|
That does seem to be the way to do things in phpbb3 phpbb3 profile fields really are terminally useless compared to what we did with xprofile fields in phpbb2.
|
Zudane
|
Would it be useful to create that as a portal, then just instruct people to create the single text area profile field "country"?
That would make things much easier for everybody that wants it, I think.
Then again, a quick guide into the phpbb3 howtodoit would be just as easy.
|
Zudane
|
Just played with it, and might need it as a portal.
The problem is that using the code..
| Code: | <!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Country" -->
<img src="./images/ranks/ccflags_medium/{postrow.custom_fields.PROFILE_FIELD_VALUE}.png" /><br />
<!-- ENDIF --> |
works great, besides one small problem... the country codes are stored in upper case, but the flags are stored as lowercase. So it's looking for say US.png when only us.png exists.
Any ideas that don't involve javascript?
|
admin (no pm's please)
|
flags should be stored in lowercase they are now.
|
Zudane
|
Works, but I noticed one thing, don't think it's really relevant though.
If the cookie is already set, it isn't resetting it, and if the cookie is deleted then this error pops up on the userinfo portal
| Code: | | [phpBB Debug] PHP Notice: in file /myffcms/com_userinfo.php on line 82: Cannot modify header information - headers already sent by (output started at /includes/template.php:831) |
It only pops up once until the cookie is set again. Noticed it because I had to delete the cookie to get it to set it as lowercase.
|
admin (no pm's please)
|
not resetting the cookie is not a bug.
Where have you put the portal?
|
Zudane
|
the index portal page. I don't have it on the full forum.
http://harsh-reality.net/index.php?component=indexpage
|
admin (no pm's please)
|
I have put a fix in, but what you say does explain the notice a bit. Hopefully it should be alright now anyway.
|
Zudane
|
a member pointed this out, I hadn't noticed...
That looks like it says unkhown. I'm not certain if it does or not, but that n sure looks like an h.
on a similar note...
is tiny... the smaller version is nigh more than a blue dot.
|
admin (no pm's please)
|
Seems my source of flags has only small flags for a lot of Countries. Will get some bigger ones.
|
Zudane
|
Member on my site (from new zealand) said that the size of the flag must be relevant to the size of the country
|
Nick(NR)
|
| admin (no pm's please) wrote: | | Seems my source of flags has only small flags for a lot of Countries. Will get some bigger ones. |
How big: http://forum.myfreeforum.org/about17401.html
25x15, which considering they can be put on the view topic, could possibly code it to pick out two flags of differing size, based on an option, choosing large would tell the portal to pick up the l_ , if small is chosen it would look for s_ at the start of the images?
e.g.
s_en.png
l_en.png
As smart as that would be, I'm going to go ahead and say it's more than what is needed tho right?
|
Zudane
|
the portal for phpbb3 can be set for the large, only way to set the image in view topic is to code the image link itself.
|
Zina2008
|
My experience of this portal has been a bit different - but I thought it might help somebody if I posted.
I had been hoping for something like this to come along, since we had a similar thing at out previous home. One of my boards is very local, but the other has members from all over the world. So really the nationality marker matters more for one board than the other.
Anyway, when this new portal was announced I installed it at both boards. It worked, but the content (avatar, flag etc) was left-justified, which looked untidy in the right-hand portal (I have a dual portal, using a pro silver base - the left is narrower than the right). So I moved it to the left, swapping it with the clock which was formerly at top left. It looked a lot better there.
But . . . after a day or two I discovered the snag. When I clicked "X new messages" at the top, I got a Fatal Error. If I clicked "User Control Panel" and then on to "Private messages" I could get to the place for writing a new message, but I still couldn't read existing ones.
I looked at the templates, but I'm not an expert, just an experimenter, and I couldn't see anything obvious. A night's pondering failed to come up with any ideas other than the easiest.
Today I swapped the portals - the clock and the User Info / Welcome - back again, and with the clock on the left and the welcome on the right, everything works as before.
So if anybody else out there has this odd little problem - put it on the right!
P.S. I couldn't have reported it here, because you wouldn't be able to see it unless you had PMs at one of the boards. I didn't copy the error message - sorry - but it mentioned the avatar, looked like something about no access to avatar.
|
admin (no pm's please)
|
The chances are it has been fixed.
Just today I have found some places where using the userinfo portal in phpbb fails to include the get_user_avatar function and thus dies with an error message. The cases I found have been fixed.
This sort of error is the sort of thing you should be quickly and accurately reporting.
|
Zina2008
|
Sorry!
I've swapped these two portals - which are called USERINFO and CLOCKWATCH - back again, via the overall_header and overall_footer templates. My page index address is: http://whiteoakforum.myfreeforum.org/index.php
Now, with the info on the left and the clock on the right, the page looks better - until I click "X new messages". Then I get this error message:
Fatal error: Call to undefined function: get_user_avatar() in /home/httpd/vhosts/slarti.myfreeforum.org/httpdocs/phpBB3/myffcms/com_userinfo.php on line 166
I've only done it on this board, but both boards have the same theme and general set-up, and the error was the same on both. Now the other one is still working, but this edited one has the problem again.
|
admin (no pm's please)
|
try now.
|
Zina2008
|
Brilliant!
Many thanks! I've tried it on the one I edited - I'll re-edit the other one later this evening, and report back if it doesn't work. But I bet your magic will have done the trick.
Update: I've done the other board now, and both are working just as they should.
Thank you so much, Admin - you've made an old woman very happy!
|
Zudane
|
I'm having trouble with this.... It's working for me, but not for my members.
If I clear the field from the profile and load the page, nothing happens. But if I clear the cookie and load the page then it sets the field correctly.
I can't expect all of my members to clear cookies to get that to work. Any idea what the problem is? It's being reported to me that it's loading on the page, but not loading into the profile, which I can verify.
Thinking of it... to keep it from constantly resetting the cookie, could you set it to check if the profile field defined in the portal options (if set) is null or empty then it will set/read the cookie to fill in the field correctly? This way it only tries to reload the field data if it's not there.
|
admin (no pm's please)
|
Working just with the cookies makes it faster, and if things were wrongly set, then time should slowly correct things. It does not seem a good idea to add database accesses to cure issues that should not happen if the debugged portal is used from scratch.
|
Zudane
|
Okay, I figured a way to make it work better, which I'll probably remove later, but for now it will get it going.
I just added a bit of code to remove the cookie when any page loads, since the portal sets and reads the cookie all in one go. I've tested it on my own and it correctly re-set the cookie and the profile field.
But, it should work.
I think the problem with it is that it only reads the cookie to fill in the profile field when the cookie is set. If this portal is placed in the page before the profile field is correctly in place, then the portal only places the cookie but doesn't set the field.
I know the cookie is supposed to expire on session end, but for me it wasn't deleting the cookie and re-setting it.
Might be something to put in the guide for it, to make sure the field is in place before the portal is used, and if any problems pop up, just wait for them to be fixed or clear cookies first.
|
|
|