MyBB Community Forums

Full Version: Advertisements with ID
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I added Coinurl to my board, and it works well:
Banner example:
<iframe scrolling="no" style="border: 0; width: 728px; height: 90px;" src="http://coinurl.com/get.php?id=1352"></iframe>

But I want to do more.
Coinurl offer a feature called "revenue sharing".
With this code:
<iframe scrolling="no" style="border: 0; width: 468px; height: 60px;" src="http://coinurl.com/get.php?id=slot-id&share=address"></iframe>
If I enter a Bitcoin address in share=address (ex: share=1HostFatgTXWdRmVoneC8M6ErhiuQ7An5o ), the address will get a % of the income from the click on the banner.

I have added a "Custom Profile Field" called "Bitcoin address".
So every user can now enter his own Bitcoin address in his profile.

What I trying to get is that all banners will show with the bitcoin address of the user that started the topic.
I want to give some of the income to users that actively participate to the board.

I'm using the "My Advertisements (2.0.3)" mod right now.
I tried to enter something like this:
<iframe scrolling="no" style="border: 0; width: 728px; height: 90px;" src="http://coinurl.com/get.php?id=1249&share={$post['fid6']}"></iframe>
But it didn't work.

Can you give me some advice? Smile

EDIT:
Is it better to move this topic to "MyBB 1.6 General Support" ?
If you are trying to add edits to My Advertisements then you should ask on the Site you got it from. If that is Pirata's plugin he only gives support to subscribers.
I'm trying another way.
I can do it by adding adv_code directly on header/footer ( so without using any mod )
But I still need the right fidX
I need to find the fidX of the user that opened the thread.

Someone suggested me this query:
select fidX from (mybb_userfields f left join mybb_users u on f.ufid=u.uid) left join mybb_threads t on u.uid=t.uid where tid=thread_id

But where can I find the thread_id? Is there a value that I can use?
Where is the best place where putting this query?


Another way that I'm thinking by looking around:
$thread = get_thread($tid);
$temppost = get_post($thread['firstpost']);
$address = $temppost['fidX'];

But I still don't know where putting this code ( is $tid always available? ), I fell a bit lost Toungue
The fidX is referring to the userfields - each userfield you add creates a new column, so you would need to refer to the correct fid by number, or set a variable eg

$coin = number of the profile field

Then you would need to get the user id of the person who made the thread etc. Thread is usually defined as tid,

so (not tested)

SELECT t.tid, t.uid, t.visible, uf.fid{$coin} AS fid FROM " . TABLE_PREFIX . "threads t
LEFT JOIN " . TABLE_PREFIX . "userfields uf ON (t.uid=uf.ufid)
WHERE t.visible = 1

Then in your while loop something like

while ($coin = $db->fetch_array($query))
{
$coin['fid'] = htmlspecialchars_uni($coin['fid']);

that would mean that if you put {$coin['fid']} in your template you would get the contents of that users profile field with the number you assigned to coin.
Ok, I already know that that $coin will be 6.

But can I put all this php code in the template or are there better places?.
I would make a plugin for it, you only want it in the first post of a thread I guess.

I am unsure HOW to make a good plugin that only affects one postbit and does not cause many queries, but you could put it on showthread.
Yes, I just want the fid of the user that made the thread.
( so the fit6 of of the "firstpost" )

What about following this way?
$thread = get_thread($tid);
$temppost = get_post($thread['firstpost']);
$address = $temppost['fid6'];
( I found part of this code around, so I'm not sure if mybb already has everything to do it )

Does it make many queries?
Anyway, I'll need this only when an user open a thread.
It should not be called while simply surfing the forums/sections.

I'll put the advertisement in the header/footer and in some posts, but always with the fid6 of the first post.

Do you have a bitcoin address? I'll give you 0.6 btc if you help me to find a good solution to this problem Smile

I'll also write a step-by-step guide to help others to do the same.
Well, I dont actually know what a bit coin is.

Anyway, it seems that what you want is to have that code

<iframe scrolling="no" style="border: 0; width: 728px; height: 90px;" src="http://coinurl.com/get.php?id=1249&share={$post['fid6']}"></iframe>

on the top of each thread and the content of that code to be the users link to these coins? I bet you could probably do this with template conditionals. I shall try it on my local host.
ÉDIT : This works, it gets the thread creators profile field fid4

<if $post['pid'] == $GLOBALS['thread']['firstpost'] then>
{$post['fid4']}
</if>

You put it in the postbit.

I have XThreads and Template conditionals installed.


<iframe scrolling="no" style="border: 0; width: 728px; height: 90px;" src="http://coinurl.com/get.php?id=1249&share="<if $post['pid'] == $GLOBALS['thread']['firstpost'] then>
{$post['fid4']}
</if>"></iframe>
The ads are mainly in the header and footer of mybb.

I think that {$post['fid6']} isn't the right data, I need the fid6 of the "firstpost", this will in the ads_code that will stay in the header/footer.

You can look here at my website:
http://www.bitcoin-italia.org
You can already see banners, the problem is that I'm not using the feature called "revenue sharing" of Coinurl.

Every users will have the Bitcoin address in their profile, example:
https://www.bitcoin-italia.org/forum/User-HostFat
( you can see my btc address at right )

The Bitcoin address is something like an IBAN, it isn't generated my the forum.
Every user will have ( if they want ) to put it in their profile.
Some users will not have it if they will not put it in.

OT
About bitcoin: http://www.youtube.com/watch?v=Um63OQz3bjo


EDIT:
Ok, I'm reading your edit ... wait a little Big Grin

(2012-10-11, 11:44 PM)Leefish Wrote: [ -> ]You put it in the postbit.
Why I need to put in the post bit?
I need to put it in the header/footer.

(2012-10-11, 11:44 PM)Leefish Wrote: [ -> ]I have XThreads and Template conditionals installed.
Ok, I've done both Smile

(2012-10-11, 11:44 PM)Leefish Wrote: [ -> ]<iframe scrolling="no" style="border: 0; width: 728px; height: 90px;" src="http://coinurl.com/get.php?id=1249&share="<if $post['pid'] == $GLOBALS['thread']['firstpost'] then>
{$post['fid4']}
</if>"></iframe>

This is the code of my header template.
{$welcomeblock}

{$pm_notice}
{$bannedwarning}
{$bbclosedwarning}
{$unreadreports}<!-- ProfileComments -->
			{$comments_alert}<!-- /ProfileComments -->
{$pending_joinrequests}

	<div id="container">
		<a name="top" id="top"></a>
		<div id="header">
			<div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a></div>
			<hr class="hidden" />
		</div>
	        <navigation>
			{$board_messages}
		<br class="clear" />
		<div id="content">

		<!--{myadvertisements[zone_1]}-->

<center><iframe scrolling="no" style="border: 0; width: 728px; height: 90px;" src="http://coinurl.com/get.php?id=1352"></iframe>&nbsp;<iframe scrolling="no" style="border: 0; width: 728px; height: 90px;" src="http://coinurl.com/get.php?id=1249&share=<if $post['pid'] == $GLOBALS['thread']['firstpost'] then>
{$post['fid6']}
</if>"></iframe></center></br>

As you can see it here:
https://www.bitcoin-italia.org/forum/Thr...267#pid267
The upper right ads is giving this address:
http://coinurl.com/get.php?id=1249&share=#
So it didn't get the {$post['fid6']}

Ok, I see that it works if I put it in the postbit, but it doesn't if I put it in the header/footer.
It seems that the $post['fid6'] value isn't available on them. ( I think that this is probably the real problem ... )
Do you know a way to make this value accessible also in header/footer template?
Pages: 1 2 3