Ning Developer Docs

Is there a way to hide the file upload link in the forum based on the discussion topic? I can hide it for all discussions with css.

Views: 0

Replies to This Discussion

yes there is! it's a little involved, but can be done with jQuery. What is your skill level with javascript/jQuery?

As an outline, using jQuery, you would find the h1 tag that holds the discussion topic and test whether it contains your criteria for hiding the upload link. If there's a match, then you would remove that link also using jQuery.
Thanks for the quick reply. I've used javascript for years, but I'm very new to jQuery. I'll give this a try. It seems like it should work.

Thanks,
DH
This code worked for me. Add to Analytics text box, found under Manage | Analytics:


<script type="text/javascript">

x$(document).ready(function() {

// Remove upload file link based on forum topic:
if (x$("div.xg_widget_forum").find("div.tb h1:contains('SEARCH_TEXT')").length > 0) x$("a.upload_link").remove();

});
</script>

put in your appropriate SEARCH_TEXT that will trigger the link removal. For example, if you had topics called "I Love YouTube", "I'm on YouTube" etc. and you wanted them all to have no upload link, you could use "YouTube" as your Search text.
Thanks TJ,

That worked for me. I was getting there slowly, but you really saved me some time.
D
You're welcome, always glad to help!

RSS

© 2024   Created by Ning Developer Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service