如何将自定义字段传递给挂钩(Invision Power Board [ipb] / PHP)
虽然可能性不大,但希望有人有一些为 Invisions Power Board 论坛编写 PHP 挂钩的经验。
我正在尝试编写状态添加代码,PHP 本身工作得很好,问题在于将 IPB 的引用传递给我的钩子。
IE 您在论坛中为 MSN 用户名设置自定义字段,然后从皮肤/模板挂钩中将自定义字段传递给挂钩,然后使用 PHP 代码检查状态。
这是我在 Global->userInfoPane 上挂钩的 IPB 皮肤代码...
<if test="authorcfields:|:$author['custom_fields'] != """>
<foreach loop="customFieldsOuter:$author['custom_fields'] as $group => $data">
<foreach loop="customFields:$author['custom_fields'][ $group ] as $field">
<if test="$field != ''">
<li>
{$field}
</li>
</if>
</foreach>
</foreach>
</if>
尽管我可以在这里轻松添加自己的皮肤挂钩。
即,
<if test="myHookHere:|:1===1"></if>
从字面上看,我需要的只是从这里传递到我的钩子的单个自定义字段条目。如果我在运行钩子时查询每个成员,那么这将导致每个页面视图产生许多额外的 sql 查询。我想要做的就是将该特定的自定义字段传递给挂钩...
即 myHookHere( $customfield['msn_username'] )
这可能吗?您如何引用自定义字段?我可以从这里执行纯 PHP 吗?
感谢任何可以提供帮助的人!我尝试了官方的 invision 论坛,但运气不佳。
A long shot but here's hoping someone has some experience coding PHP hooks for Invisions Power Board forum.
I'm attempting to code a status addition and the PHP works fine on it's own, it's the passing of the IPB's reference to my hook that is the issue.
I.E. You setup a custom field in your forum for MSN Username, then from within a skin / template hook you pass the custom field to the hook and then use your PHP code to check on the status.
Here is the IPB skin code I am hooking into on Global->userInfoPane...
<if test="authorcfields:|:$author['custom_fields'] != """>
<foreach loop="customFieldsOuter:$author['custom_fields'] as $group => $data">
<foreach loop="customFields:$author['custom_fields'][ $group ] as $field">
<if test="$field != ''">
<li>
{$field}
</li>
</if>
</foreach>
</foreach>
</if>
Although I could easily add my own skin hook here.
i.e.
<if test="myHookHere:|:1===1"></if>
Literally all I need is a single custom field entry from here passed to my hook. If I query every member when the hook is run then that will result in many extra sql queries per page view. All I want to do is pass that specific custom field to the hook...
i.e. myHookHere( $customfield['msn_username'] )
Is this possible? How do you reference the customfield? Can I execute pure PHP from here?
Appreciate anyone that can help! I tried the official invision forums but not had much luck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想在 IPB 上观看此线程..我有一些类似的问题..我正在尝试分别设置 $field 标题和 $field 值的样式..这可能会帮助您获取 $field 值信息..
链接是: http://community.invisionpower.com/主题/306236-customize-custom-fields-view/
You might want to watch this thread over at IPB.. im having somewhat of a similiar question.. Im trying to style the $field title and $field value seperately.. this might help you as far as getting just the $field value information..
link is: http://community.invisionpower.com/topic/306236-customize-custom-fields-view/